Hey there,

My $head_title variable is currently showing "
| " on my pages. I only want this variable to display the page node title. How do I gain access to editing what goes into this and other $[variable]'s?

js

Comments

webchick’s picture

Located in /themes/engines/phptemplate/phptemplate.engine

$head_title specifically is:

  if (drupal_get_title()) {
    $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'drupal'));
  }

...

'head_title'          => implode(' | ', $head_title),

So if you only have '|', you might have a blank site title? Check admin/settings and make sure the proper values are listed there.

PurpleEdge’s picture

Or, is it incredibly hard to find some reference to the admin/settings page in the on-line documentation? I would have thought this page would have been near the top of the list, in a "Getting Started" page somewhere in the docs, but I can't seem to find any reference to it?

Not shooting the messenger [g] just using JetSetter's question to ask why it is so hard to find answers to the simple things?

Now someone might answer with a link directly to the appropriate page, but please explain how you found that page, because I couldn't - and I knew what I was looking for!

webchick’s picture

Configuration, which mentions going to admin/settings to get to the basic settings. And then there are sub-pages that explain what some of the more advanced settings on that page are.

I found this by starting at the Handbooks page. This gave me a list of all 5 handbooks (About Drupal, Installation/Upgrading, Configuration and customization, Developer, and Documentation). Of those, I chose Configuration and customization, because I know at this point Drupal is already installed, so the next step is to customize it to my needs.

From there, I glanced through the items on the side, and picked Configuration, since this seemed like a good place to start. And voila, on the front page was the blurb about admin/settings.

If you have some feedback into how to make this process easier, or how to improve the documentation, please by all means sign up to the Documentation mailing list, and/or submit issues (along with fixes if possible!) directly to the Documentation issues queue. We can use help, especially from the perspective of "still learning" Drupal users (once you get past a certain point, it becomes obvious to you where things are and then you lose this perspective).

Hope that helped, and glad jetsetter got their issue fixed. :)

webchick’s picture

There should be a link from the default install message to admin/settings so you don't have to hunt for a handbook page at all. Looks like while the link is there, it's pointed to the wrong place. I've added a patch to the welcome message which will solve this problem for 4.7. Thanks for pointing it out. :)

PurpleEdge’s picture

I knew it had to be somewhere because I, and umpteen other users, have obviously managed to figure this out. I just suspect that it could have saved a lot of people a lot of searching and ferriting around, and forum questions etc etc if it was more easily accessible, or better explained.

Learning a product by using hunting up and down the menu system is one way, I guess?

PurpleEdge’s picture

but, (had to be a but!) how would you know from reading that page, or from anywhere in the documentation, that the "Site-Name " is set here? Paradoxically, the three less critical properties are mentioned in the text, so would probably show up in some sort of search - If you knew what to search for?

And, to be even more difficult, where would I find reference to $Head and $Site_Name - I'm pretty sure I found a list of variables once, but can't remember where?

I'll happily sign up to contribute to the documentation, just have my reservations that the foundations aren't that solid.

jetsetter’s picture

Webchick, you rock.

My phptemplate.engine actually had the following line(s):

...
  $vars = array(
    'head_title'          => (drupal_get_title() ? strip_tags(drupal_get_title()) .' | '. variable_get('site_name', 'drupal') : variable_get('site_name', 'drupal') .' | '. variable_get('site_slogan', '')),
    'language'            => $GLOBALS['locale'],
    'site'                => variable_get('site_name', 'drupal'),
...

I changed the 'head_title' line to:

    'head_title'          =>  drupal_get_title(),

And things are good. Thank you.

js

poloparis’s picture

ok, bear with me, i'm new to Drupal (but loving it) and php, and i searched and i searched the forums ( i promise )

the phptemplate.engine sets the $head variables and many more, but... where does it get them from ???

ok, i see it gets them from the menu admin/home/administer/settings/general settings, but if i were to assign them a different way, how would i do it ? where does Drupal store these ?

is it possible to assign constants to $head and other vars ?

or should i NOT do that at all ?

Hackenaton’s picture

"is it possible to assign constants to $head and other vars ? "

I am coming from a background in hardcoding browser end scripts and sites, so the idea of having these $ variables NOT controlled by me is foreign....