Content title

robbo

No avatar

2005-06-07 15:13

Hi,

I'm trying to get the name of Content pages to show automatically. I'm using the contact.tpl file to show the content, as that is the only way I could figure out how to get the content to show, but the content page title shows CONTACT US on all content pages.

My contact.tpl: $sContentLeft

With $sContentLeft removed from contact.tpl it removes all content on the pages, but with it there, it shows the content but the title is contact us.

robbo

No avatar

2005-06-09 11:34

Anyone able to help?

wizzud

No avatar

2005-06-09 15:00

I'm not exactly sure what it is that you are trying to achieve.
The contact.tpl is there for the use of the Contact content page, which is the one content page that cannot be deleted. Why, and how, are you trying to use it for other content? What is the problem with simply adding a content page from Admin?
[BTW what version QC?]

robbo

No avatar

2005-06-09 15:49

Ok, sorry I haven't explained it very well. Basically in the above linked page, I have changed the layout and design etc. When I add a new content page, i would like the bit that says CONTACT US to be "New Content Page Title"

Like this: http://images.agservegts.com.au/qchelp.gif
I can't figure out what template file to put $aSite[sTitle] in (if that is the correct variable). Currently it's in the head.tpl

In regards to the

"With $sContentLeft removed from contact.tpl it removes all content on the pages, but with it there, it shows the content but the title is contact us."

in my previous post, I was referring to the contact.tpl file, and the variable "$sContentLeft", if that variable is removed then every content page has no information on it.

Hope I didn't confuse you toooo much. and thanks for your reply :)

robbo

No avatar

2005-06-12 09:52

Sorry, forgot to say QC version, I'm using 0.2.5

wizzud

No avatar

2005-06-13 09:01

Robbo:
I have no idea what the bottom of your index.php file looks like but mine looks like this (with line numbers add for my reference purposes):

1 else{
2 if( !isset( $bDisplayedPage ) ){
3 if( strlen( $p ) > 2 )
4 $p = substr( $p, 2 );
5
6 if( !is_numeric( $p ) )
7 $p = 0;
8
9 $sContentLeft = throwContentSite( $p );
10
11 if( !isset( $sContentLeft ) ){
12 $p = 0;
13 $sContentLeft = throwContentSite( $p );
14 }
15
16 if( $p == 0 ){
17 if( isset( $send ) )
18 $sContentRight = sendEmail( $_POST, 'contact_send.tpl' );
19 else
20 $sContentRight = $tpl->tHtml( 'contact_form.tpl' );
21 $content .= $tpl->tHtml( 'contact.tpl' );
22 }
23 else{
24 $sContentRight = throwFotosForSite( 'foto_list.tpl', $p );
25 if( isset( $sContentRight ) && !empty( $sContentRight ) )
26 $content .= $tpl->tHtml( 'columns_two.tpl' );
27 else
28 $content .= $tpl->tHtml( 'columns_one.tpl' );
29 }
30 }
31 }


Lines 6/7 and 11-14 are the error-handling code and the reason why you can't delete the Contact page: if there is a problem with $p, or it can't find content matching $p,it will display the Contact page ($p=0).
Any content page must have one column - $sContentLeft - and can have 2 columns - $sContentRight - as defined by the template files columns_one.tpl and columns_two.tpl.
Line 9 gets the main content, as entered in the textarea box via Admin.
Assuming there's something in it, and its not going to default back to the Contact page, then you get down to line 24 which looks for a photo assigned to the content page (via Admin) and loads it into the second column ($sContentRight) if found.
Lines 25-28 call either columns_one.tpl or columns_two.tpl depending on whether or not $sContentRight (the second column with the photo) has something in it.
So basically, all content pages that you add via Admin use either columns_one.tpl or columns_two.tpl depending on exactly how much information you set for for the content page itself.

To get the title of the content page you need to make a couple of changes round line 9:

9 $aFullContent = throwContentSiteArray($p);
10 if(isset($aFullContent)){
11 $sContentLeft = $aFullContent['sContent'];
12 }

This does exactly what line 9 used to do, with the exception that the title of the content page is now accessible in $aFullContent['sTitle'] (if it found the page!). By making appropriate changes to columns_one.tpl and/or columns_two.tpl to include $aFullContent[sTitle] you get the title of the content page displayed!

Of course, all the above relates to an unmodified index.php so you may have to pick out the bones if you've made drastic changes!

robbo

No avatar

2005-06-13 14:54

Hi Wizzud,

Thanks for your very detailed reply, will have a play around with it all tomorrow!

Regards
Rob :)

robbo

No avatar

2005-06-14 09:18

Hi Wizzud,

I have played around with the information, and edited the columns_*.tpl files to add $aFullContent[sTitle] into them, but where the title is meant to be, I get

'sTitle']

instead of the actual title - this doesn't show on the ?p=productsList page, but does on the content pages ( ?p=p_2 )

Image is linked below, or you can have a look at it currently at http://test.agservegts.com.au

Regards
Rob

wizzud

No avatar

2005-06-14 14:03

Take out the single quotes!

robbo

No avatar

2005-06-15 01:11

hey hey!

Thanks for your time and help Wizzud! Now working perfectly!

Regards,
Rob

Back to top
about us | contact