XF 2.2 SVG map as forum header

dvsDave

Well-known member
So, I have been creating a geographical set of subforums. I want a map to show off the different regions. I created an SVG with the regions and embedded a link into the svg. (https://www.controlbooth.com/maps/the_grid.svg)

Where I'm struggling is embedding this into the description of the forum. I try to paste the HTML and get an error that the HTML is too long:

Code:
XF\Db\Exception: MySQL query error [1406]: Data too long for column 'description' at row 1 in src/XF/Db/AbstractStatement.php at line 230
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 198
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 79
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 96
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 324
XF\Db\AbstractAdapter->update() in src/XF/Mvc/Entity/Entity.php at line 1531
XF\Mvc\Entity\Entity->_saveToSource() in src/XF/Mvc/Entity/Entity.php at line 1258
XF\Mvc\Entity\Entity->save() in src/XF/Mvc/FormAction.php at line 71
XF\Mvc\FormAction->XF\Mvc\{closure}() in src/XF/Mvc/FormAction.php at line 189
XF\Mvc\FormAction->run() in src/XF/Admin/Controller/AbstractNode.php at line 112
XF\Admin\Controller\AbstractNode->actionSave() in src/addons/EAEAddons/AdminTools/XF/Admin/Controller/Category.php at line 41
EAEAddons\AdminTools\XF\Admin\Controller\Category->actionSave() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2513
XF\App->run() in src/XF.php at line 524
XF::runApp() in admin.php at line 13


I need to make sure this works on mobile and desktop, but at a loss of how to embed this.

Also, I need the map to NOT show up on the main forum listing page.
 
Last edited:
Solution
I figured it out!


So, I ended up having to create a widget position (category_top) for the top of the category view template.
(get in development mode, then admincp -> Development (bottom of main left menu) -> Widget Position

Then added the position in the master template in the category_view template (master template only accessible in development mode, btw)

Find:
HTML:
<xf:breadcrumb source="$category.getBreadcrumbs(false)" />

<xf:if is="$nodeTree">
In between those two lines, add:
HTML:
<xf:widgetpos id="category_top" context-category="{$category}" />

Then I created an HTML Widget, set it's position as Category Top.
Added the SVG code, set it to Advanced Mode
and set the...
So, I'm an idiot and completely forgot about widgets, but dear god, I am lost with widget conditionals

so, if I understand the conditionals correctly 😅

Code:
xf:if is="$forum.node_id == 182"

Should be what I put in the display conditional field? does it need to be wrapped in HTML brackets, or am I completely wrong on the syntax?
 
I figured it out!


So, I ended up having to create a widget position (category_top) for the top of the category view template.
(get in development mode, then admincp -> Development (bottom of main left menu) -> Widget Position

Then added the position in the master template in the category_view template (master template only accessible in development mode, btw)

Find:
HTML:
<xf:breadcrumb source="$category.getBreadcrumbs(false)" />

<xf:if is="$nodeTree">
In between those two lines, add:
HTML:
<xf:widgetpos id="category_top" context-category="{$category}" />

Then I created an HTML Widget, set it's position as Category Top.
Added the SVG code, set it to Advanced Mode
and set the Display condition to:
Code:
$xf.reply.containerKey == 'node-XXX'
(replace XXX with your desired category node ID)
 
Solution
Back
Top Bottom