Relative Link to Home (or any other page)
Permalink 5 users found helpful
I would like to hard-wire a link into my template that includes a button. This button links to the homepage, and is reproduced on all pages. While I could just as easily just do an absolutehttp://www.mysitehere.com link, I'd like to know if it'd be possible to do it with a few PHP lines and a relative link—just to be extra bulletproof.
I've read up on the URL helpers and some other topics on the subject, but I couldn't see an answer quite to this specific problem. I'm a novice at PHP though, so I was wondering if there was a simple couple of lines of PHP that would build a relative path from wherever the current page is in the site tree.
I've read up on the URL helpers and some other topics on the subject, but I couldn't see an answer quite to this specific problem. I'm a novice at PHP though, so I was wondering if there was a simple couple of lines of PHP that would build a relative path from wherever the current page is in the site tree.
Thanks Mnkras, had found that answer before but didn't understand it due to the context.
Works perfectly.
Works perfectly.
Man, this is great! This is what I've wanted to know for the last year, but I guess I never phrased my question correctly. Thanks, Mnkras!
or
<a href="<?php echo DIR_REL; ?>/">Home Page</a>
will go to the homepage of the site
<?=$this->url('sitemap');?>
goes to <c5root>/sitemap
etc