Last active
June 23, 2017 14:29
-
-
Save brooke-heaton/97a622a80690fccd2cfc82809691c907 to your computer and use it in GitHub Desktop.
Map Drupal 7 node and url_alias tables
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
<?php | |
/** | |
* The alias table entries are prefixed with the actual path | |
* /node/nid | |
*/ | |
function return_node_titles_and_aliases() { | |
$results = db_query(" | |
SELECT | |
n.nid, n.title, | |
a.source, a.alias | |
FROM {node} n | |
LEFT JOIN {url_alias} a | |
ON CONCAT('node/', nid) = source | |
")->fetchAll(); | |
foreach ($results as $result) { | |
dpm($result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment