everlifefree Posted January 5, 2008 Share Posted January 5, 2008 Ok I don't know if this is possible through either php or javascript or anything really but what I was hoping for was a way to alter the title of my site depend on what is in the frame sorta thing. Ok to give you a little background my site run with a frame sorta thing going on. there is a frame.tpl file where you pretty much set the header and footer for the site. Then there is a whatever.tpl for each page that has your body content. Here's what I was thinking you could maybe do: Frame.tpl: Has the main head tags with the title <title>Site Name - {new.title}</title> page.tpl: Has something that you put what you want {new.title} to be changed to. <NewTitle>whatever you wanted</New Title> Or something similiar... Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/ Share on other sites More sharing options...
beansandsausages Posted January 5, 2008 Share Posted January 5, 2008 i would do it in php a little sumit like this : <html> <?php $second_title = "Sub Page"; ?> <title>Main Title - <?php $second_title ?> </title> <//html> i would do sum it like that. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-431077 Share on other sites More sharing options...
everlifefree Posted January 5, 2008 Author Share Posted January 5, 2008 Ok but where do I place each, in the php file or the tpl file? Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-431424 Share on other sites More sharing options...
everlifefree Posted January 6, 2008 Author Share Posted January 6, 2008 If some one could tell me how exactly to implent this then I could mark it SOLVED... Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-431600 Share on other sites More sharing options...
HaLo2FrEeEk Posted January 6, 2008 Share Posted January 6, 2008 It needs to be dynamic, but if you have a tpl that can read from an array dynamically generated by the php page, then put the static variable in the tpl file. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-431655 Share on other sites More sharing options...
everlifefree Posted January 8, 2008 Author Share Posted January 8, 2008 I'm sorry but huh?? how would you know that?? Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-433188 Share on other sites More sharing options...
HaLo2FrEeEk Posted January 13, 2008 Share Posted January 13, 2008 Sorry for the bump. I know that becuase I know php and I've worked a lot with tpl files in phpbb. It's not complicated, just takes a while to learn. If I'm interpretting your question right, then what I said before should help you out. We aren't just going to tell you waht to do though becuase then you don't learn. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-437596 Share on other sites More sharing options...
everlifefree Posted January 13, 2008 Author Share Posted January 13, 2008 Ok, but I have tried several different ways... Heres the one I think I got closest on: I put this in my index.php "pageName"=>$second_title, On my frame.tpl I put: <title>{siteName} - {pageName} </title> And Last of all I on my home.php I put: $second_title = "Sub Page"; But all I ended up with was "Spade Space - " would it be better to add the <?php $second_title = "Sub Page"; ?> to my home.tpl Or is there another way to do this... Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-437798 Share on other sites More sharing options...
Hypnos Posted January 13, 2008 Share Posted January 13, 2008 Is this for PHPbb, or are you using some TPL parsing code? Make sure your order is right. If you're not loading home.tpl before that line in the index.php, then it won't work. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-437799 Share on other sites More sharing options...
everlifefree Posted January 13, 2008 Author Share Posted January 13, 2008 I'm running phpizabi I'm not sure what loads first Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-437808 Share on other sites More sharing options...
twostars Posted January 13, 2008 Share Posted January 13, 2008 In all of my scripts lately, I gather the data together into a variable, and output them into a HTML document, which is located in another folder. To do this, I use sprintf() a lot. This way, I can easily modify headers and stuff before anything is really sent to the user, plus I get an easy-to-change layout. So, in relation to your question, I can define $title whenever I like. The final result will be outputted along with the rest of the stuff, and will be filled into the pre-made template document. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-437831 Share on other sites More sharing options...
HaLo2FrEeEk Posted January 13, 2008 Share Posted January 13, 2008 Second_title MUST be set before it is called, otherwise it will be echoed as an empty variable. If you're using a tpl file, then you shouldn't need to edit the tpl, index, AND home pages. My guess is that index.php calls up home.php, which sets certain variables, then index.php takes care of the template. Try setting second_title on the index page. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-437855 Share on other sites More sharing options...
everlifefree Posted January 13, 2008 Author Share Posted January 13, 2008 wait that will only allow me to have on input I would like a different input for each page Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-438313 Share on other sites More sharing options...
everlifefree Posted January 13, 2008 Author Share Posted January 13, 2008 Ok, I tried putting it on the index.php file and it still didn't work. PLEASE HELP!! I put this in my index.php $second_title = "Sub Page"; ~~before~~ "pageName"=>$second_title, On my frame.tpl I put: <title>{siteName} - {pageName} </title> But all I ended up with was "Spade Space - " Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-438418 Share on other sites More sharing options...
Lamez Posted January 14, 2008 Share Posted January 14, 2008 You could do this add the title.php as a include ( include "title.php"; ) and in title.php: Website Name :: <?php switch ($title) { case 'home': echo "Home"; break; case 'login': echo "Login"; break; case 'register': echo "Register"; break; case 'spay': echo "Start Playing"; break; } ?> index.php or what ever you want: $title="home"; <title><?php include ("title.php"); ?> </title> -Any Help? Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-438432 Share on other sites More sharing options...
everlifefree Posted January 14, 2008 Author Share Posted January 14, 2008 That didn't work Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-438446 Share on other sites More sharing options...
redarrow Posted January 14, 2008 Share Posted January 14, 2008 use double "" quotes Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-438452 Share on other sites More sharing options...
HaLo2FrEeEk Posted January 15, 2008 Share Posted January 15, 2008 Where is site name set? Find the variable that sets SiteName and put the title next to it. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-439505 Share on other sites More sharing options...
everlifefree Posted January 15, 2008 Author Share Posted January 15, 2008 I tried that but it doesn't allow you to change the page name depending on the page. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-439515 Share on other sites More sharing options...
HaLo2FrEeEk Posted January 16, 2008 Share Posted January 16, 2008 It would be a start, it would let you know if your page name variable is even being read properly, from there you move farther and farther away til you get it how you want it. Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-440712 Share on other sites More sharing options...
everlifefree Posted January 17, 2008 Author Share Posted January 17, 2008 it's set in my conf.inc.php file Quote Link to comment https://forums.phpfreaks.com/topic/84588-alter-title/#findComment-441485 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.