-
☆ A M B ☆
- 24,524 Posts
That depends on what you are using this ID number for. If you want to find the Id of the page currently being processed (which will becomes the "games" page) then the MODx tag to get its ID would be [*id*]. If you’re using it in a snippet, you would use $modx->documentIdentifier.
Some snippets, such as Ditto, that process many documents to make a list, use a placeholder [+id+] for the ID of the document they are processing at that point, while [*id*] would still indicate the main document where the snippet call is and where the list will be displayed.
If I’m understanding you, It sounds like you want your snippet to get the document ID of another document (not the current one) by using its alias. It can be done with a DB query, but it’s generally a bad practice (and very seldom necessary) because it may break if the alias changes. It’s also tricky (but can be done) if you want to process only published pages or pages the current user has access to.
If you tell us why you want it and what you’re trying to do in more detail, maybe we can suggest another way to go about it.
-
☆ A M B ☆
- 24,524 Posts
How are you keeping track of visits?
-
☆ A M B ☆
- 24,524 Posts
As long as you don’t have duplicate aliases it will be a simple query to the database. If you have alias paths and duplicate aliases, it gets more complicated.
You have the alias you want to look up, so query like this:
$result = $modx->db->select("id", $modx->getFullTableName("site_content"), "alias ='" . $alias . "'");
if($modx->db->getRecordCount($result) == 1) {
$docId = $modx->db->getValue($result);
}
(sorry about that, had to run an errand before I could test it; this one works)
-
☆ A M B ☆
- 2,213 Posts
Quote from: Bruno17 at Jun 08, 2009, 03:44 AM
maybe thisone is helpful for you: *LINK REMOVED*
Chrome is flagging that site as having malicious content... I’m guessing it’s over protective?