- This topic is empty.
-
AuthorPosts
-
May 1, 2011 at 2:24 am #32555
chrisburton
ParticipantMay 1, 2011 at 10:02 am #48240ChrisBull
MemberNot sure if it will work but can’t you use $_SERVER; which should return everything after index, so if in the url you have http://www.site.com it will have a value of / or if the url is http://www.site.com/news/ it would return /news/ etc.
then do something like this,,,
$urlValue = $_SERVER;
if($urlValue == "/") {
$titleValue = "";
} else {
$urlValue = ltrim($urlValue = "/");
$urlValue = rtrim($urlValue = "/");
$titleValue = " | " . $urlValue;
}
//////Then in the Title Tag
I can’t see why it wouldn’t work but i havn’t tested it and it’s probably not the best way to go about it….
May 1, 2011 at 11:27 am #48247chrisburton
ParticipantI want to say Chris made a screencast which showcased this but I can’t remember. Your code somewhat works but if I have a subdomain the title displays:
John Doe | /
May 1, 2011 at 11:32 am #48248chrisburton
ParticipantFixed it by changing out the = and adding commas for $urlValue.
$urlValue = $_SERVER;
if($urlValue == "/") {
$titleValue = "";
} else {
$urlValue = ltrim($urlValue, "/");
$urlValue = rtrim($urlValue, "/");
$titleValue = " | " . $urlValue;
}Another question is how to get the title to be capitalized?
May 1, 2011 at 11:59 am #48150chrisburton
ParticipantFor anyone wanting to know:
$urlValue = $_SERVER;
if($urlValue == "/") {
$titleValue = "";
} else {
$urlValue = Ltrim($urlValue, "/");
$urlValue = Rtrim($urlValue, "/");
$titleValue = " | " . ucfirst($urlValue);
}
?>Title
Thanks @chrisbull for getting me started
May 1, 2011 at 11:30 pm #48034whiteInkDesign
Memberwhats adding the dynamic body ID? I’ve been using
">
to make the filename the body id.May 1, 2011 at 11:51 pm #48036chrisburton
Participant@whiteinkdesign i’m confused by your response
May 2, 2011 at 1:17 am #48037whiteInkDesign
MemberI figured it out, had a blonde moment.
May 2, 2011 at 2:11 am #48039chrisburton
Participant@whiteinkdesign Oh, sorry. I thought you were questioning my code, not asking a question yourself.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.