Figuring out the parent link in html.tpl.php -


Is there a way to find out the title of the original page in html.tpl.php? I am asking because I change my background image, depending on what original link was selected on my page. Hope this makes sense, URL:

Thanks, Ron


It did not understand how this can be done ... Modify my architecture Doing and PHP is a server-side programming language ... When a user requests a page, the server executes PHP for that page and sends the resultant HTML to the user. PHP communication only happens in such a way that the user only sees the resultant HTML if the user needs to interact with PHP (like changing page output), then the user must initiate another page request.

Javascript client-side programming language is the common server environment, JavaScript execution is only on the user's machine (not on the server). Javascript execution does not occur during PHP execution, so you can not combine the javascript code with the PHP code. RAJ's suggestion to use Java does not answer your question, and your answer was trying to blend JavaScript with PHP.

In Drupal words, you have a collection of nodes on your site through the organized menu. You want to change a specific image on the page (I am going to accept the Quote Lotus logo) whenever a user is viewing a child page of a specific first-level menu item. For example, to see "our history" or "get here" (instead of the default quote logos logo) a different image will be added in some way to the original item of "The Lodge".

The easiest solution because it seems that you are not very familiar with the Drupal, the image as a background-image property as an img element Instead of specifying in the CSS Each page must have a special class attribute that applies to the body element of its page. For example, on the "Our History" page, one of the classes applied to the body element is Page-node-7 . Page-node-7 is not applicable in Drupal on any other page. You can quickly see the unique category of each page and for each property, background-image You can add CSS properties to change. If you want to use this method but make it a bit cleaner, you may be able to make it better by applying a custom square on each page to make it better under the "The Lodge" menu item Each page that has been added can add "Lodge-Image" class, this will change the image for specific pages without the need to modify the CSS directly to content editors. . I'm assuming (I may be wrong) that in the Drupal 7 node class module will add a class to the HTML container of the node as well as the element of the body. Alternatively, better solution will be to use the Drupal module to select the logo based on some menu or path positions. This will only work if the image is set in the Drupal using the logo configuration option (in the Surat settings). The most suitable module would probably be, but it has not yet evolved for the Drupal 7, so it is not an option yet. Dev publication is a Drupal7 release that is not generally recommended for use on production sites, but it seems that it is worth a shot.

Some other methods that are better but will be more difficult: To override / set the logo in the .ppp preprocess function, either set the logo or create a custom image block ( And add a new area in your theme to display the block), change the logo tool into Drupal 7, yourself, the CSS method beyond the menu ancestors (menu entry) requires additional work For) to automatically insert a class attribute in Body Entry, write a new module, and I can think of something else.

So you have a lot of options.

Comments