Jump to content

Echoing UrlSegment?


Recommended Posts

Is there a way to echo a URL segment for example to use in the <title> tag?


<title><?php echo $page->title; ?> | <?php echo $input->urlSegment(2); ?></title>

The above code was my stab at it but I'm not sure if segments can be called in this way?

Sorry, should point out that this is within a header.inc template

Edited by onjegolders
Link to comment
Share on other sites

For my page titles, I have found another way of doing it with the following code:

<title>Site Name | <?php if ($page->rootParent->title != $page->title) {echo $page->rootParent->title . " | ";} ?><?php echo $page->title; ?></title>

Would still be interested to know if you can echo or use urlSegments in if statements though.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...