PDA

View Full Version : Forum Title as Image or Text (Depending on page)


cinnamonbits
10-28-2008, 11:35 PM
Hey there everyone. I'm a novice when it comes to php and even more so when it comes to vBulletin's plugin and hook system. I would be grateful if anyone could help me with a problem I'm having.

On my forum's index page, I would like to have the titles of the forums appear as linkable images. How I figured I'd do this is simply edit the Forum Title to be an image. Yet, I realized that it was an image anywhere the forum title appeared.

I then attempted to create a plugin which would decipher whether or not the forum title was being called on the index.php page. If so, it would show the image, and if not, it would show the text title. This is the code I attempted to use in the plugin:

$currentFileName = $_SERVER['PHP_SELF'];

$page_parts = Explode('/', $currentFileName);

$button_page_name = $page_parts[count($parts) - 1];

if ($button_page_name == "index.php")
{
$north_button = "<img src=\"images/buttons/site_buttons/north_button.png\" border=\"0\">";

}
else
{
$north_button = "North";
}

I then went to the forum settings and attempted to set the forum title to:

<?php echo $north_button; ?>

This did not work, and I must say that I am thoroughly perplexed as to what I should do. Thank you in advance for any guidance.

Rich
10-29-2008, 02:26 AM
I would use template conditions if I were trying to do that. Something along these lines:

<if condition="THIS_SCRIPT == 'index'">Show Image<else />Show text</if>