Created
May 22, 2012 07:47
-
-
Save gionn/2767396 to your computer and use it in GitHub Desktop.
Drupal 7 ~ Retrieve last page nid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template.php template_preprocess_page() | |
<?php | |
if ($node->type == 'page') { | |
$result = db_query("SELECT nid FROM {node} WHERE type = 'page' AND status=1 ORDER BY created DESC LIMIT 1"); | |
$arr = $result->fetchAssoc(); | |
$variables['last_page_nid'] = $arr['nid']; | |
} | |
?> | |
templates/page.tpl.php | |
<?php | |
print $last_page_nid; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment