By tarheeldev on
I am trying to customize the tags based on the output of a PHP script I have running in the body field on a basic page node.
As far as I can tell, it involves re-setting the [current-page:page-title] token, but I'm not sure how to do that.
Can someone help or point me in the right direction?
Comments
When you say that you're
When you say that you're trying to customize the tags on the page, are you referring to the taxonomy for the node? I'd suggest that you don't put PHP into the body field of a page since it's not a good idea to store PHP in the database, but instead rewrite the title in a preprocess function in the theme. The preprocess function and possibly editing the page template to override the page title should work.
If the above isn't helpful and you post the PHP script your running, I can get a better idea of what you're trying to accomplish.
Basically, the node has PHP
Basically, the node has PHP code in the body field that is a script querying a separate database. The variables are fed to the script through query parameters in the URL.
For example, the URL might be:
mysite.com/node/22?query=12345
Then the script takes "12345" and outputs the information from the separate database. One of the fields that can be returned from the separate database is a "title" field, and I want to make that the for mysite.com/node/22?query=12345
I'd strongly suggest using
I'd strongly suggest using the approach listed here - http://drupal.org/node/816456#comment-3042936, where you'd define a database connection to the external database in settings.php, and use
hook_views_data()to expose that database to views. You can then use an argument based on the query parameters in the URL to get what data you need for the view and place that data on the page usingviews_embed_view()(in the theme layer).Or you can display it on the page with this module http://drupal.org/project/viewfield which will render the view as a field each time the page is loaded. I haven't used this module personally so you may have to create a new token as well for the query string argument, but creating tokens is fairly straightforward. http://drupal.org/project/token.
Either way you'll be able to use the data in other places on the site and you'll be avoiding storing PHP in the database which can be a security risk.
I ended up doing it with code
I ended up doing it with code like this:
drupal_set_title("foo");