Dax IX
03-15-2010, 03:50 AM
I'm doing something totally wrong here, and if someone could give me a little help I'd really really appreciate it. :)
I'm trying to replace some navbar links with images, and it's not working. I'm using an edited template and a plugin.
vbcms_navbar_link:
<vb:if condition="$vboptions['selectednavtab'] == 'vbcms'">
<li class="selected">
<a class="navtab" href="{vb:raw vboptions.site_tab_url}{vb:raw session.sessionurl_q}">{vb:rawphrase site}</a>
<ul class="floatcontainer">
{vb:raw template_hook.vbcms_navbar_start}
<vb:if condition="$links">
<vb:each from="links" value="link">
<li><a href="{vb:raw link.url}"><vb:if condition="$pngexists"><img src="$pngexists" border="0" /><vb:else />{vb:raw link.title}</vb:if></a></li>
</vb:each>
<vb:else />
<li class="hidden"> </li>
</vb:if>
{vb:raw template_hook.vbcms_navbar_end}
</ul>
</li>
<vb:else />
<li><a class="navtab" href="{vb:raw vboptions.site_tab_url}{vb:raw session.sessionurl_q}">{vb:rawphrase site}</a></li>
</vb:if>
Plugin:
$pngtitle = '{vb:raw link.title}';
$pngtitle = str_replace(' ', '', '$pngtitle');
$pngexist = '/home/starship/public_html/fora/images/buttons/' . $pngtitle . '.png';
if (file_exists($pngexists)) {
$pngexists = '/fora/images/buttons/' . $pngtitle . '.png';
}First of all, I'm not sure what hook to use for this plugin.
Other than that, should this work?
Thanks!
Chani
--------------- Added 1268684680 at 1268684680 ---------------
I just realized that I have this in the wrong forum.
Could a moderator please move it to vB4 programming?
Thanks!
--------------- Added 1268704502 at 1268704502 ---------------
using the same template, I've read a little more about template variables, but I'm still trying to figure this out.
Forgive my ignorance in programming.
$pngtitle = '{vb:raw link.title}';
$pngtitle = str_replace(' ', '', '$pngtitle');
$pngexist = '/home/starship/public_html/fora/images/buttons/' . $pngtitle . '.png';
if (file_exists($pngexists)) {
$pngexists = '/fora/images/buttons/' . $pngtitle . '.png';
}else{
$pngexists = '';
}
/* render template and register variables */
$templater = vB_Template::create('navbar');
$templater->register('pngexists', $pngexists);
$templater->render();
--------------- Added 1268705282 at 1268705282 ---------------
Again, please forgive my ignorance here, but how do you translate the template variable {vb:raw link.title} to php for my plugin?
I'm trying to replace some navbar links with images, and it's not working. I'm using an edited template and a plugin.
vbcms_navbar_link:
<vb:if condition="$vboptions['selectednavtab'] == 'vbcms'">
<li class="selected">
<a class="navtab" href="{vb:raw vboptions.site_tab_url}{vb:raw session.sessionurl_q}">{vb:rawphrase site}</a>
<ul class="floatcontainer">
{vb:raw template_hook.vbcms_navbar_start}
<vb:if condition="$links">
<vb:each from="links" value="link">
<li><a href="{vb:raw link.url}"><vb:if condition="$pngexists"><img src="$pngexists" border="0" /><vb:else />{vb:raw link.title}</vb:if></a></li>
</vb:each>
<vb:else />
<li class="hidden"> </li>
</vb:if>
{vb:raw template_hook.vbcms_navbar_end}
</ul>
</li>
<vb:else />
<li><a class="navtab" href="{vb:raw vboptions.site_tab_url}{vb:raw session.sessionurl_q}">{vb:rawphrase site}</a></li>
</vb:if>
Plugin:
$pngtitle = '{vb:raw link.title}';
$pngtitle = str_replace(' ', '', '$pngtitle');
$pngexist = '/home/starship/public_html/fora/images/buttons/' . $pngtitle . '.png';
if (file_exists($pngexists)) {
$pngexists = '/fora/images/buttons/' . $pngtitle . '.png';
}First of all, I'm not sure what hook to use for this plugin.
Other than that, should this work?
Thanks!
Chani
--------------- Added 1268684680 at 1268684680 ---------------
I just realized that I have this in the wrong forum.
Could a moderator please move it to vB4 programming?
Thanks!
--------------- Added 1268704502 at 1268704502 ---------------
using the same template, I've read a little more about template variables, but I'm still trying to figure this out.
Forgive my ignorance in programming.
$pngtitle = '{vb:raw link.title}';
$pngtitle = str_replace(' ', '', '$pngtitle');
$pngexist = '/home/starship/public_html/fora/images/buttons/' . $pngtitle . '.png';
if (file_exists($pngexists)) {
$pngexists = '/fora/images/buttons/' . $pngtitle . '.png';
}else{
$pngexists = '';
}
/* render template and register variables */
$templater = vB_Template::create('navbar');
$templater->register('pngexists', $pngexists);
$templater->render();
--------------- Added 1268705282 at 1268705282 ---------------
Again, please forgive my ignorance here, but how do you translate the template variable {vb:raw link.title} to php for my plugin?