Tenzing Posted March 24 Share Posted March 24 I want to add a popup glossary to my Body copy with HannaCode. Example, my Body field is: The best way to drive[[gloss tag="drive"]] the golf ball is to use a stead backswing[[gloss tag="backswing"]] and follow through smoothly... My HannaCode is: <?php namespace ProcessWire; if (isset($tag)) { $faq_page = $pages->get('template=faq-answer,name='.$tag); if ($faq_page->id) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i_for_loop = 0; $i_for_loop < 10; $i_for_loop++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } $popup_idname = "glossary-{$randomString}"; echo "<a data-toggle='{$popup_idname}'><i class='fi-info'></i></a>"; echo "<div class='dropdown-pane' id='{$popup_idname}' data-dropdown data-hover='true' data-hover-pane='true'>"; echo "<div><strong>{$faq_page->get('headline|title')}</strong>: {$faq_page->details_text}</div>"; echo "</div> "; } } ?> It woks nearly awesome, and inserts the <a>INFO ICON</a> correctly in the Body output, and then after that it inserts the hidden popup html. The popup works etc. However, After the first ICON processwire inserts the </p> BEFORE the rest of the Body. instead of at the end If I add more than one glossary definition to the Body, only the first one has this problem. The (Body ending </p> that TinyMCE puts in has already been rendered. All the others ICON links work awesome no other </p> tags are added. I end up with something looking like this: The best way to drive ICON the golf ball is to use a stead backswing ICON and follow through smoothly... Link to comment Share on other sites More sharing options...
Tenzing Posted March 24 Author Share Posted March 24 As far as I am concerned I would be happy if TinyMCE/Processwire NEVER added the <p> and </p> tags to the beginning and end of my Body field output (or even all textarea fields). If this is possible it would be perfect solution. Link to comment Share on other sites More sharing options...
Tiberium Posted March 25 Share Posted March 25 On "natural" textfields, processwire don't add anything. The Rich Text editor like TinyMCE add code, because it is in the end a WYSIWYG-Editor. But as an example, when the first line of my TinyMCE field is a headline, it doesn't add a p-Tag before this. It begins with the headline tag. As it should. And even not add any p-tag when the headline is the only thing in my textbox. HannaCode add a p-Tag around the output, you can deactivate this behaviour on the edit dialogue of the HannaCode self. Aside from the option above, a autoclose behaviour can come from TinyMCE or from your browser, when it thinks a p-tag is open but should be closed, before a block-element (like div's). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now