Qantas94Heavy Posted April 3, 2013 Share Posted April 3, 2013 I attempted to search the forums for my request, however was not able to find this simple request. One of the things I'd like is for HTML titles (the one you place in <title></title> tags) to be able to be editable from the admin interface without changing the text shown in the navigation bar. A basic example would be on the homepage of a site - you want the navigation bar to say "Home", the <title> property being "Welcome" and your headline being "Start Your Journey!", or something similar. Currently I add this directly using PHP's echo, however if there was a faster, less cumbersome way to do so it would be much appreciated. Thanks! Link to comment Share on other sites More sharing options...
Marty Walker Posted April 3, 2013 Share Posted April 3, 2013 Hi, Welcome to the forums. You might need to setup an extra field, for example: alt_title - for your HTML titles <title><? echo $page->alt_title; ?></title> If your alt_title field is empty - you might not need it on every page - you can just output the page title instead: <title> <? if($page->alt_title) { echo $page->alt_title; } else { echo $page->title; }; ?> </title> I hope I've understood your question. Regards Marty 2 Link to comment Share on other sites More sharing options...
Qantas94Heavy Posted April 3, 2013 Author Share Posted April 3, 2013 Thanks for the quick reply. That's exactly what I was looking for, didn't know it would be so simple. Also is it normal that if you click "view" without clicking the save button first, that you lose all of your edited work? Hi, Welcome to the forums. You might need to setup an extra field, for example: alt_title - for your HTML titles <title><? echo $page->alt_title; ?></title> If your alt_title field is empty - you might not need it on every page - you can just output the page title instead: <title> <? if($page->alt_title) { echo $page->alt_title; } else { echo $page->title; }; ?> </title> I hope I've understood your question. Regards Marty Link to comment Share on other sites More sharing options...
Marty Walker Posted April 3, 2013 Share Posted April 3, 2013 Great. Yeah, you do need to save before viewing. Regards Marty Link to comment Share on other sites More sharing options...
horst Posted April 3, 2013 Share Posted April 3, 2013 Hi and welcome! <title> <? if($page->alt_title) { echo $page->alt_title; } else { echo $page->title; }; ?> </title> I like the short version of this: <title><?php echo $page->get('alt_title|title');?></title> You may let PW do the work for you 2 Link to comment Share on other sites More sharing options...
ryan Posted April 4, 2013 Share Posted April 4, 2013 You can go even shorter if you want to <title><?=$page->{'alt_title|title'}?></title> 3 Link to comment Share on other sites More sharing options...
Pete Posted April 7, 2013 Share Posted April 7, 2013 You can go even shorter if you want to <title><?=$page->{'alt_title|title'}?></title> With curly braces? Link to comment Share on other sites More sharing options...
ryan Posted April 7, 2013 Share Posted April 7, 2013 With curly braces? I don't often use that syntax, but if trying to make something consume as few characters as possible, it works. Link to comment Share on other sites More sharing options...
Pete Posted April 10, 2013 Share Posted April 10, 2013 Ah right, I didn't think you'd posted a mistake but it's one I've not personally seen before Link to comment Share on other sites More sharing options...
alxndre Posted April 11, 2013 Share Posted April 11, 2013 Also is it normal that if you click "view" without clicking the save button first, that you lose all of your edited work? http://modules.processwire.com/modules/form-save-reminder/ I often also forget to save before viewing. This module from soma, takes care of that problem. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now