Jump to content

PageIcon?


RandyC

Recommended Posts

So im wanting to play with the page title thing.

 

I want to be able to add an icon for each page, they do the page title with a function:

{$pagetitle}

 

im curious is there a way to make a custom one like:

{$pageicon}

 

Thanks,

Randy

Link to comment
Share on other sites

not quite what i want, I don't want to have to pick the icon for each page, I want to put {$pageicon} right next to the {$pagetitle} in the header.tpl file and then set the icon via the language files.

Link to comment
Share on other sites

not quite what i want, I don't want to have to pick the icon for each page, I want to put {$pageicon} right next to the {$pagetitle} in the header.tpl file and then set the icon via the language files.

 

I'm not sure exactly what you mean by putting it right next to the title?

If you want to set it using the language files you could do:

<img src="templates/{$template}/images/{$LANG.pagenameicon}.png"

Or something like that.. If that's not what you want perhaps let me know what the desired output source would look like :)

Link to comment
Share on other sites

Nope i want the image to change per page and only have to put one line on one page.

 

For example:

I have this setup for the title of my sidebar area:

5800261905D1200958150D550738.png?direct

 

If you look in the header.tpl file at the bottom it says '{$pagetitle}' this is what gives the page its title in the main content area, I want to put '{$pageicon}' next to that line and have it work exactly the same was as the pagetitle one but with images instead.

Link to comment
Share on other sites

Nope i want the image to change per page and only have to put one line on one page.

 

For example:

I have this setup for the title of my sidebar area:

5800261905D1200958150D550738.png?direct

 

If you look in the header.tpl file at the bottom it says '{$pagetitle}' this is what gives the page its title in the main content area, I want to put '{$pageicon}' next to that line and have it work exactly the same was as the pagetitle one but with images instead.

 

The $pagetitle is within <title> tags. You can't put an image there. Just like in the default template try putting this in the header:

<img src="templates/{$template}/images/{$filename}.png" alt="{$pagetitle}" />

 

Obviously change the file extension to jpg, gif, if needed.

you could also use css classes as well:

<div id="{$filename}">
   <div class="icon"></div>
</div>

#contact .icon {
   display: block;
   width: 50px;
   height: 50px;
   background: url(images/icons/contact.gif);
   }

Link to comment
Share on other sites

Yes I know it is in the header but it is also in the main content, open your 'header.tpl' file and go to the VERY BOTTOM of it, you will find something along the lines of this:

 

<h2>{$pagetitle}</h2>

 

You know when your at the homepage of your WHMCS at the top it says "Portal Home" thats generated by using the pagetitle code.

Link to comment
Share on other sites

Yes I know it is in the header but it is also in the main content, open your 'header.tpl' file and go to the VERY BOTTOM of it, you will find something along the lines of this:

 

<h2>{$pagetitle}</h2>

 

You know when your at the homepage of your WHMCS at the top it says "Portal Home" thats generated by using the pagetitle code.

 

Well not in "mine" as I've completely recoded most of it, but I get what you're saying. If you're talking about just creating the smarty variable "{$pageicon}", then in your header you could do this:

{php}
global $smarty;
$title = $smarty->get_template_vars('pagetitle');
$pageicon = "<img src=\"images/".basename($_SERVER['PHP_SELF'], ".php").".gif\" alt=\"".$title."\" />";
$smarty->assign('pageicon', $pageicon);
{/php}

 

Then "{$pageicon}" would output

<img src="images/index.gif" alt="Portal Home" />

 

That what you're looking for?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated