Pagetitle trough PHP

General discussions about WebYep
Post Reply
Eelco
Rank 1
Rank 1
Posts: 25
Joined: Sun Sep 18, 2011 1:50 pm

Pagetitle trough PHP

Post by Eelco » Thu Dec 01, 2011 4:56 pm

Is there a way to dynamic change the page <title></title> element trough PHP, reflecting the content of a webyep short text element?

marcus
Objective Development
Objective Development
Posts: 170
Joined: Tue Nov 30, 2010 1:25 pm

Re: Pagetitle trough PHP

Post by marcus » Thu Dec 01, 2011 5:23 pm

Yes, you can use the WebYep API to fetch the contents of an element. For a ShortText element this would look like the following example.

Regular definition of a ShortText named "YourFieldName", not global:

Code: Select all

<?php webyep_shortText("YourFieldName", false); ?>

Print the contents of the previously defined ShortText element:

Code: Select all

<?php echo webyep_sShortTextContent("YourFieldName", false); ?>

Note that you must provide the same parameters to webyep_shortText() and webyep_sShortTextContent() and both code snippets must be on the same page.

Eelco
Rank 1
Rank 1
Posts: 25
Joined: Sun Sep 18, 2011 1:50 pm

Re: Pagetitle trough PHP

Post by Eelco » Thu Dec 01, 2011 7:10 pm

Thank you: that is very helpful!

wilsondavid
Posts: 1
Joined: Tue Dec 20, 2011 6:52 pm

Re: Pagetitle trough PHP

Post by wilsondavid » Tue Dec 20, 2011 7:00 pm

For displaying the page title for your PHP page you have to write following code :

<html>
<head>
<title><?php print("$title"); ?></title>
</head>
<body</body>
</html>

Post Reply