I just rebuilt our division's portal from an old and creaky drupal version to 4.6. One request was for a "message from the VP" style block on the front. Since the mission statement was already set up for this, I decided to just make a block in the mission statement like this:
<img align="right" width="75" src="/images/ourvp.png"><b>VP's Corner</b><br>Here's a message from the VP that welcomes everyone to the portal, and is regularly updated with short messages from the chief..<br><br clear="all">
This looks nice, with a small picture of the VP in the top right and a nice text flow. It looks good in my modified Marvin theme.
Next, I wanted to make the body text on the mission easily editable by the VP without having to go to "admin/settings". I made a node with the same text as the mission statement and got the following PHP snippet to output the text:
<?php
/*
dumps out just the node content on node 38
*/
$nid = '38';
$result = node_load(array(nid=>$nid));
$output .= $result->body;
?>
Now, to allow changes to that node to update the mission, I changed chameleon.theme like so:
Find the section:
<?php
$output .= " <td id=\"main\">\n";
// insert mission statement, if one is set
// only parse if we're on the front page
if ($_GET["q"] == variable_get("site_frontpage", "node") && ($mission = variable_get('site_mission', ''))) { */
$output .= "\n<!-- begin mission -->\n";
$output .= '<div id="mission">' . $mission . '</div>';
$output .= "\n<!-- end mission -->\n";
}
?>
comment out that section and replace it with something like this:
<?php
/* replacement for mission output, allowing update from a node */
$output .= "
\n";
// insert mission statement, if one is set
// only parse if we're on the front page
if ($_GET["q"] == variable_get("site_frontpage", "node") && ($mission = variable_get('site_mission', ''))) {
$output .= "\n
\n";
$output .= "
VP's Corner
|