Posted by dplh on November 5, 2009 at 7:37pm
Jump to:
| Project: | Front Page |
| Version: | 6.x-1.2 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Dublin Drupaller |
| Status: | closed (fixed) |
Issue Summary
Hi,
This is a great module and suits my needs perfectly, but I am having trouble with the following. I have tried searching drupal.org and the internet and have not come up with a solution, although they seem pretty simple issues:
1) How can I change the node title from "Home" to something else?
2) How can I include Links (such as the Addtoany button, the "Print" and "Send to friend" links from the Print module, etc) in the bottom of the front page?
Thanks!
Comments
#1
there's no facility to do that from within t he front_page.module settings page as such apart from redirecting users to a specific node...which is the easiest way of achieving what you want.
hope that helps
dub
#2
Thanks Dublin Drupaller,
I do like how the module can redirect - but I ran into the issue that a user who has just logged in still sees the anonymous front page. I have noticed this issue in the issue list a few times and it is my understanding that this is unavoidable.
Then I checked "Allow embedded PHP code in this front page" and put the following in for the body of the anonymous front page:
<?php$node = node_load(3);
print $node->title;
print $node->body;
?>
and the same thing with a different node id for the authenticated front page.
This works well for 1) getting both the title and the body of a node into the front page 2) getting the correct front page for an anonymous user and an authenticated user, even right after login.
However for the life of me I have not been able to figure out how to print the $links after the body....I tried print $links but this didn't work.
Would you happen to have any ideas on this?
#3
I did this:
<?php$node = node_load( 1 );
drupal_set_title( $node->title );
$node->title = '';
$output = node_view( $node, FALSE, TRUE );
$output = str_replace( $GLOBALS['base_url'] . '/' . $node->path, $GLOBALS['base_url'], $output );
print $output;
?>
The node_view function fully prepares the node and returns HTML, with all the bits and pieces in place, including all various_modules_nodeapi calls executed upon viewing the node, which is where all your links and other stuff should come from, and passes everything through the theme layer as well (which is probably what you want).
Setting the title to empty prevents it from showing up as an <h2>. I used the drupal_set_title call to make it the <h1> level title instead, which is how I wanted it to look.
I did an extra step with the str_replace function as I'm using the sexy bookmarks module, and didn't want the url to the actual node #1 in the bookmarks URL but rather just the URL to my site, so this function call strips the unwanted bit.
Hope that helps.
shawn