Created
January 2, 2012 02:40
-
-
Save sleepdeprecation/1549064 to your computer and use it in GitHub Desktop.
Display all pages from a drupal site
This file contains 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
<?php | |
$q = " | |
SELECT node.vid,node_revisions.title,node_revisions.body from node_revisions,node WHERE node_revisions.vid = node.vid and node.type = 'page' | |
"; | |
$c = mysql_connect("[host]", "[user]", "[pass]"); | |
mysql_select_db("[db name]"); | |
$r = mysql_query($q, $c); | |
$link = array(); | |
while ($row = mysql_fetch_array($r)) { | |
array_push($link, $row); | |
} | |
foreach ($link as $l) { | |
echo "<li><a href='#" . $l['vid'] . "'>" . $l['title'] . "</a></li>"; | |
} | |
foreach ($link as $l) { | |
echo "<div id='" . $l['vid'] . "'><h2>" . $l['title'] . "</h2>" . $l['body'] . "</div>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment