e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 214 forks source link

Question: SiteLink Plugin " title=""> #3395

Closed LaocheXe closed 6 years ago

LaocheXe commented 6 years ago

Doing some testing and tried using my Voice eXe plugin in Site Links, using {VOICE_EXE} in the Url place - hit save, (no name) - notice that it displays in the main nav bar - just showing " title=""> (Also, it stretches the navbar so it can fit)

Now if I remove the Url - and put # then use the Function (Voice) - I get this: {VOICE_EXE} (No drop down menu).

SimSync commented 6 years ago

@LaocheXe What is the return value of the shortcode {VOICE_EXE}? Could you post some screenshots, how the "create sitelink" page looks before and after saving?

You could also have a look into the vstore plugin: In e_header.php https://github.com/e107inc/vstore/blob/master/e_header.php the menu item html is defined. And in e_sitelink.php https://github.com/e107inc/vstore/blob/master/e_sitelink.php the submenu get's defined.

LaocheXe commented 6 years ago

https://github.com/LaocheXe/Voice-eXeSystem

voice1

voice2

voice3

Above images shows the Shortcode working via theme_shortcodes.php Below shows the Site Link Plugin Shortcode

capture1

capture2

capture3

Below shows what I have used/tried in Site Links in Admin Area

capture4

If I remove the Name 'VoiceLink' it still displays the " title=""> If I remove URL '{VOICE_EXE}' then it wont display {VOICE_EXE} - however, the dropdown link wont function wont work correctly. if I leave the URL alone and switch the Function from Voice to none, I still get the " title=""> Shortcode works in the *URL section, just the addtional " title=""> that shows up, and it's not in my Shortcode, in fact I have no title=""> in e_shortcode.php

capture5

CaMer0n commented 6 years ago

@LaocheXe The 'title' displaying indicated broken HTML markup earlier on. Whatever is in VOICE_EXE, please add the following right before your shortcode returns data. Replace $text with whatever you use in the shortcode.

e107::getDebug()->log($text);

then, enable 'basic' mode in the debugger to view the output in the footer.

LaocheXe commented 6 years ago

First thing First. I did what you said, but I did not try the SiteLink Shortcode just yet.

capture1

With it On

capture2

Message: My Shortcode (creates link/dropddown menu) - Function: voice_shortcodes->sc_voice_exe()() (Where is the send () coming from?) - File: /e107_handlers/shortcode_handler.php Line: 264

CaMer0n commented 6 years ago

@LaocheXe I suggest to use e_sitelink only and not place a shortcode in the URL field.

LaocheXe commented 6 years ago

@CaMer0n I already have one - and tried it, same results - https://gist.github.com/LaocheXe/6a6b9314673f5e064cca895adbe48992 <-- whats in my e_sitelink.php

LaocheXe commented 6 years ago

@CaMer0n Also, since I should use {SHORTCODE} in the url - what do I put there? Because URL is required.

LaocheXe commented 6 years ago

Matter of fact, IDK how to use e_sitelink.php with my shortcode - using $voiceexe = {VOICE_EXE}; returns an syntax error. using $sc = e107::getScBatch('voice', true); $voiceexe = $sc->voice_exe; returns no error, but doesn't display at the top - but down at the bottom with debug plugin enable, I see it like in the screen shot above, where it displays the shortcode dropdown menu

CaMer0n commented 6 years ago

@LaocheXe For URL just put #

Also, try adding this to your sitelinks function:

 return $tp->parseTemplate("{VOICE_EXE}",true); 
LaocheXe commented 6 years ago

@CaMer0n that works some what.

Before: before

Admin: admin

After: after

Last Picture you see the 'Voice Plugin' name as a dropdown menu, but nothing is there - then you see 'Comms' dropdown (yes it works) - but breaks the navbar.

CaMer0n commented 6 years ago

@LaocheXe I'm sorry, I can only guess now without seeing the source code.

LaocheXe commented 6 years ago

@CaMer0n https://github.com/LaocheXe/Voice-eXeSystem/tree/master/voice

https://github.com/LaocheXe/Voice-eXeSystem/blob/master/voice/e_shortcode.php#L384

https://github.com/LaocheXe/Voice-eXeSystem/blob/master/voice/e_sitelink.php#L85

CaMer0n commented 6 years ago

@LaocheXe Okay, so this code is wrong:

<ul class="nav navbar-nav navbar-right">
            <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$VoiPlug_Name.' <b class="caret"></b></a>
            <ul class="dropdown-menu">
            <li>
            '.$voice_exe.'
            <p></p>
            </li>
            <li class="divider"></li>
            <li>
            <a href="'.e_PLUGIN.'voice/voice.php">'.LAN_VOICE_VIEWERS.'</a>
            </li>
            </ul>

The sitelink function places code INSIDE the dropdown-menu. What you're providing is the code in the main-menu and the drop-down menu code. I suggest you replace this with a simple "hello world" and make your changes gradually and test regularly, so you'll know what in your code causes a break. Please see e107_plugins/_blank/e_sitelink.php for working examples.

LaocheXe commented 6 years ago

@CaMer0n everything in the code looks fine but the

- which I should change that. only thing I can think of is maybe the

CaMer0n commented 6 years ago

You need to remove this:

<ul class="nav navbar-nav navbar-right">
            <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">'.$VoiPlug_Name.' <b class="caret"></b></a>
            <ul class="dropdown-menu">

</ul>

And replace your <li> items with <div>

See if that helps.

LaocheXe commented 6 years ago

One step closer, just need to re-do the css for it, and kept the old style as well - thanks you your help/guidance.