In Pulse 4 it was possible to write PH code inside superblocks.
Today I tried this with Pulse 5 but that does not work, it just prints out the whole php command.
So PHP doesn’t work in superblocks anymore?
In Pulse 4 it was possible to write PH code inside superblocks.
Today I tried this with Pulse 5 but that does not work, it just prints out the whole php command.
So PHP doesn’t work in superblocks anymore?
That depends!
HTML + JS work fully. As for PHP…
In reality it was a potentially dangerous security hole so we added some code to eval the PHP in a sb_block and capture the output to make P5 much more secure.
Not sure what PHP code you are trying to insert but here a few solutions you could use:
Good luck with the project
Okay, I understand. I just wanted to set the CSS class for navigation.
Like this:
<a href="/about" <?php if(basename($_SERVER['REQUEST_URI'])=="about"){echo "class='active'";}?>>ABOUT</a>
This setting of active should be a standard thing. @pulsecms we should add that into the standard nav tag. Also good for further RW nav integration.
Thanks for the info.
I have used the “Tag/Plugin” way, simple but effective.
My simple solution, if someone needs it too:
link-active.php
inside /inc/tags
<?php
$classname = $GLOBALS['tag_var1'];
$pagename = $GLOBALS['tag_var2'];
if (basename($_SERVER['REQUEST_URI'])==$pagename)
{
echo "class=\"" . $classname . "\"";
}
?>
My navigation looks like this:
<nav id="primary-menu" class="style-3">
<ul>
<li {{link-active:current:Home}}>
<a href="Home">
<div>Home</div>
</a>
</li>
<li {{link-active:current:Ueberuns}}>
<a href="Ueberuns">
<div>Über Uns</div>
</a>
</li>
<li {{link-active:current:Produkte}}>
<a href="Produkte">
<div>Produkte</div>
</a>
</li> . . .
Where “current” is my active class and the second parameter the pagename of course.
Thanks Oliver. Did you perform test with a 2nd level navigation or a blog page?
Looks great and nice solution @Oliver
Active links in the front end is already included in navigation since P5…
Honestly, I didn’t test that, it was more like a rush job.
But I would say that it just doesn’t work because the pagename does not match the first level.
I have to try that out.
This topic was automatically closed after 5 days. New replies are no longer allowed.