CUSTOM PAGE TITLE USING "title" & "subtitle" fields on current page?

4 posts by 3 authors in: Forums > CMS Builder
Last Post: April 29, 2013   (RSS)

By csdesign - April 22, 2013

Hello!  

I pulled the code I needed from the cmscookbook but I have a question.  I've tried, but can't get this to work.  

I would like the page title to come from the field "title" and "subtitle" on any given page (detail page, list page & single record pages)

Can I somehow make $pagesRecord generic so it would just pull the title from whichever page that showing in the browser?

<title><?PHP echo $pagesRecord['title']; ?>,<?PHP echo $pagesRecord['subtitle']; ?>Company Name Here</title>

My meta tag data is currently in my "include_header.php" file.
If there is a way to do this, I'm assuming I could do the same with the description and keyword fields also. 

Thanks so much!! Tina

Hi Tina,

What code are you using and could you rephrase the issue you're having (I don't quite understand)?

What do the title and subtitle do now, and what do you want them to do.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Hi Tina, 

Did you resolve this issue? If not what about using something like this:

<?php $metaTitle = (@$pageRecord)?  $pagesRecord['title'].','.$pagesRecord['subtitle'].'Company Name Here' : 'Alternative title text here'; ?>
<title><?phg echo $metaTitle; ?></title>

So if $pageRecord is set before include_header.php is included, then in include_header you could detect if $pageRecord has been set, and if it hasn't display an alternative header instead, which in this example would be Alternative title text here.

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com