Log in

View Full Version : Resolved title dynamic - half way there



gaogier
11-27-2011, 06:31 PM
I have created this.

http://pastebin.com/5fFdT6n6

I now need to get the title of the guide type showing.

Example, http://runehints.com/quests/149/All_Fired_Up - the title should be .:RuneHints:. Quests - All Fired Up
http://runehints.com/quests/114/Another_Slice_of_H.A.M. would be .:RuneHints:. Quests - Another Slice of H.A.M.

traq
11-27-2011, 07:28 PM
I have created this.
http://pastebin.com/5fFdT6n6
it would be more efficient (and much easier to make changes) if you made an array to hold all the titles, and then just check if the key exists:
<?php
function checkPage($key){
// define all your titles
$titles = array(
'quests' => 'Quests'
,'randoms' => 'Random Events'
,'etc.' => 'and so on, and so forth'
);
// check if the requested title exists
// return it if it does
// return default title if it does not
return !empty( $titles[$key] )?
$titles[$key]:
'the Solution to all Your RuneScape Problems';
}


I now need to get the title of the guide type showing.showing where?

gaogier
11-27-2011, 07:36 PM
Oh, that does seem easier.

In the title of the page - Example, http://runehints.com/quests/149/All_Fired_Up You see the title is .:RuneHints:. Quests - I want that page to show .:RuneHints:. Quests - All Fired Up instead.
I want the main page quests/ to just show up ..ts:. Quests

Other quests to show the name of the quest, and other pages to show up the relevant titles - example, skills/ would show ..ts:. Skills but the guide http://runehints.com/skills/13/Cooking would show ..ts:. Skills - Cooking.

All in the title of the browser.

..ts:. I mean .:RuneHints:.

traq
11-27-2011, 07:44 PM
So, you want it to appear in the <title> element, correct? What CMS/forum software are you using?

gaogier
11-27-2011, 07:47 PM
Custom made, (want the code?) using tinymce - I thought the software maybe important...

http://pastebin.com/TK8FAZh8 - the quest.php code

traq
11-27-2011, 08:13 PM
I don't see anything that sets the page title in there (I'll admit that I didn't review it in its entirety). Do you know where the page title is set? Is it in a template, or stored in the database and set by a function somewhere?

gaogier
11-27-2011, 10:09 PM
Thank you for your help, problem now resolved.

OH, btw, I emailed you on your website from your signature :D

traq
11-27-2011, 11:38 PM
no problem! glad you got it figured out.
replied.

If your question has been answered, please mark your thread "resolved":
On your original post (post #1), click [edit], then click [go advanced]. In the "thread prefix" box, select "Resolved". Click [save changes].