0

I have a website which uses a PHP content management system to add and edit articles (see example article: http://bournemotorclub.co.uk/latestnews.php?fn_mode=fullnews&fn_id=41 )

What I'd like to be able to do is to set the title of the HTML page (which at the moment, in the example above, is BMRC: Latest News) to the subject of the article (ie 'Review of 2013' in the example above)

Does anyone have any experience with doing this sort of thing, or have any advice as to the coding I need to use. I've tried using:

<title> <?php $news_info['subject'] ?> </title>

but that just left the title blank.

Any help given is very much appreciated.

Thanks.

1
  • 3
    It happens to everyone... ;) echo Commented Feb 14, 2014 at 11:09

3 Answers 3

4

Assuming you have all your connection details and other php files set up, all you would need to do is this:

<title> <?php echo $news_info['subject'] ?> </title>
Sign up to request clarification or add additional context in comments.

5 Comments

Well no, everyone knows shorthand. Nothing to copy. The original answer was valid, i just added this in to offer separate options.
better not to use shorthand (which is actually short tags not shorthand) in all cases :)
Think i will remove the short tag idea. Forgot about xml header issues/not supported etc
Also, @RajMohan i could understand your point if i completely ripped your answer, however i answered first with the current answer and i don't appreciate the downvote on this answer based on the fact i added short tags.
@RajMohan i removed it because of the above comment ^ regarding short tags. Nothing to do with your answer dude, let it go.
1

You are missing echo:

<title> <?php echo $news_info['subject'] ?> </title>

Comments

0

You are missing echo: Plz check the answer

<title> <?=$news_info['subject']?> </title>

1 Comment

Why was he down voted he did not give the same answer he used shorthand which is what most templates use anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.