^Top link at the bottom of the page

General project discussion. NOT for help questions.
Post Reply
User avatar
singha
Forum Members
Forum Members
Posts: 50
Joined: Tue May 23, 2006 7:52 am

^Top link at the bottom of the page

Post by singha »

Hi,

how I can replace the ^Top link at the bottom of the page with an image?

Thanks . . . .
nivekiam

Re: ^Top link at the bottom of the page

Post by nivekiam »

I think you could just replace the smarty markup with plain old html

{anchor anchor='main' text='^ Top'}



Kevin
cyberman

Re: ^Top link at the bottom of the page

Post by cyberman »

Not sure if that will work  ::) ...

{anchor anchor='main' text=''}

Maybe " must be masked. Not tried yet.
User avatar
singha
Forum Members
Forum Members
Posts: 50
Joined: Tue May 23, 2006 7:52 am

Re: ^Top link at the bottom of the page

Post by singha »

Hi cyberman,

thanks, it works  8)
nivekiam

Re: ^Top link at the bottom of the page

Post by nivekiam »

Both will work.  But you'll need to deal with the templating engine doing more work for something that can just be plain HTML.  For a simple little tag like that you probably won't notice a difference unless you have a really high traffic site and then PHP and MySQL will probably get crushed long before Smarty takes a dive.

Warning, unrealistic and stupid test ahead....

When I changed my template and did a quick test of adding 310 of those links I saw a .01 second speed increase in using plain HTML versus Smarty markup.

That was with a really scientific test...  310 links happened to be how many times I copied and pasted.  I applied the changes to the template using Smarty markup, reloaded the page several times, never getting below .16xxx seconds.  Then I applied the changes to the template using plain HTML and reloaded the page several times, staying in the high .14xxx and low .15xxx time frame.

Mind you I only did that to see if there was a difference, there is, but it's so small it's all going to get down to personal preference.  I prefer plain HTML as it's easier to read the template.
faglork

Re: ^Top link at the bottom of the page

Post by faglork »

nivekiam wrote: I think you could just replace the smarty markup with plain old html

{anchor anchor='main' text='^ Top'}



Kevin
Must be (note the "#"):

Code: Select all

<p><a href="#main" title="top"><img src=/path/to/image"></a>
AFAIK.

I'd prefer plain HTML, too. Correct me if I'm wrong, but IMO it absolutely makes no sense using smarty here.

Cheers,
Alex
Last edited by faglork on Fri Jan 11, 2008 9:32 am, edited 1 time in total.
nivekiam

Re: ^Top link at the bottom of the page

Post by nivekiam »

True.  Thanks.  The haste of typing and not testing...

I don't understand why Smarty is used there either.  The name "main" still has to be specified so it's not like some magical tag you put in there and it's dynamically getting the anchor's name so if you change the name of the anchor at the top, it will automatically update all references to it.
faglork

Re: ^Top link at the bottom of the page

Post by faglork »

Aaaah, I think I got it ...

if you use the plain href solution, it will not work with the normal installation since a base href is inserted as soon as you use {metadata}.

The base href refers to the domain, so a simple #main will always lead to the top of the HOMEPAGE.

I have not tested this. Anyone?

Cheers,
Alex
Last edited by faglork on Fri Jan 11, 2008 11:14 pm, edited 1 time in total.
nivekiam

Re: ^Top link at the bottom of the page

Post by nivekiam »

Just tested, yes with the default install this will not work.  Looks like you can change it in plugins/function.metadata.php.  That file has a comment mentioning that you can change this setting in config.php.  There is currently nothing in config.php where you can change showbase, so I tried adding: $config['showbase'] = false; and that didn't work (don't know if I did that right or not).  But setting the linke $showbase = true to false did made the base URL go bye-bye.

I'd like to change this setting in config.php so I don't have to always update a core file when I upgrade.  This should be a setting that one can either change in config.php or the admin interface, right along with entering the rest of the global metadata there.

Personal preference, but I don't like using base.  But I'm also the type of guy who doesn't like using relative URLs...  No, I'm not going to get into nor am I trying to start a petty debt about absolute vs relative URLs, each have their merit.
faglork

Re: ^Top link at the bottom of the page

Post by faglork »

nivekiam wrote: I'd like to change this setting in config.php so I don't have to always update a core file when I upgrade.  This should be a setting that one can either change in config.php or the admin interface, right along with entering the rest of the global metadata there.
I second that ...

Alex
cyberman

Re: ^Top link at the bottom of the page

Post by cyberman »

faglork wrote: Must be (note the "#"):

Code: Select all

<p><a href="#main" title="top"><img src=/path/to/image"></a>
OK, another puzzled solution

Code: Select all

<a href="{root_url}/index.php?{$query_var}={$page_alias}#main">^ Top</a>
nivekiam

Re: ^Top link at the bottom of the page

Post by nivekiam »

Thank you calguy1000 for pointing me to this.

In your template, if you set {metadata showbase='false'} then it won't generate the troublesome base tag.

No need to edit config.php or function.metadata.php.
faglork

Re: ^Top link at the bottom of the page

Post by faglork »

Ahhhh ...!

Sometimes it is just too easy.

Thx,
Alex
Post Reply

Return to “General Discussion”