How do i call the introtext field from another page. I tried using a snippet with the following code but i am unable to call the field.
<?php
/**
* Snippet: Get info from another page
*
*/
$id = (isset($id) && is_numeric($id)) ? $id : false;
$field = (isset($field)) ? $field : false;
if (!$id || !$field) {
return '';
} else {
$output = $modx->getPageInfo($id,1,$field);
}
return $output[$field];
[!introtext? &id=`5` &field=`introtext`!]
I believe the getRourseField snippet in the component library may be able to support here.
DM
Have a look at FastField too.
...
-
☆ A M B ☆
- 24,524 Posts
That is Evolution snippet tag syntax; which version of MODx are you using?
-
☆ A M B ☆
- 1,780 Posts
Might want to check out the Revolution documentation, and in particular the Revo tag syntax here:
http://rtfm.modx.com/display/revolution20/Tag+Syntax
If you're using documentation from wiki.modxcms.com/, don't. That's the old Evo documentation. Stick with
http://rtfm.modx.com/display/revolution20/Home
-
☆ A M B ☆
- 1,780 Posts
Maybe I'm missing something here, but if you want to include the introtext in another page, why not just use getResources, make a chunk with the [+introtext] placeholder and limit the resourceId to 5?
-
☆ A M B ☆
- 3,141 Posts
Quote from: DangerMouse1981 at Jul 13, 2013, 02:58 AMI believe the getRourseField snippet in the component library may be able to support here.
DM
^ use
getResourceField:
[[getResourceField? &id=`5` &field=`introtext`]]
Install it through System > Package Management > Download Extras and then use the code ^