Unsure of what you are asking opengeek.
I have my snippet tag in a page by itself.
The important thing is not to stop questioning. Curiosity has its own reason for existing. One cannot help but be in awe when he contemplates the mysteries of eternity, of life, of the marvelous structure of reality. It is enough if one tries merely to comprehend a little of this mystery every day. Never lose a holy curiosity.
-Albert Einstein (1879 - 1955)
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Looking at your original posted snippet code.
You have a table in the database named tblabout
It has columns in it named names & content
Your chunk is named about
The about chunk should contain these placeholders:
[+about+] & [+name+]
If all the above is correct just call your snippet on the page.
Thanks for the reply bunk58
I will post an update of my code again;
Chunk name is About
<h3>[+name+]</h3>
<p>[+about+]</p>
Snippet name is about
<?php
$output = '';//create variable for holding the output
$sql = $modx->db->query( 'SELECT * FROM `tblabout` LIMIT 0, 1000');//define the DB query, in this case the table is named 'tblabout', add WHERE AND etc. as needed
$resultArray = $modx->db->getRow($sql);//put it into an array
foreach($resultArray as $item) //go through each record in the array
{//start looping through the data array
$params['name']=$item['names'];//set the placeholders, the $params sets the name of the placeholder, the $item is the field name from the DB table
$params['about']=$item['content'];
$output.=$modx->parseChunk('About', $params, '[+', '+]');//define the chunk name and process the content
}//finish looping through the data array
return $output;//now return the output from the processed chunk
?>
I got the snippet from the wiki.
http://wiki.modxcms.com/index.php/DB_query_and_Placeholders
The important thing is not to stop questioning. Curiosity has its own reason for existing. One cannot help but be in awe when he contemplates the mysteries of eternity, of life, of the marvelous structure of reality. It is enough if one tries merely to comprehend a little of this mystery every day. Never lose a holy curiosity.
-Albert Einstein (1879 - 1955)
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
DB table has three columns in it ID, names, content
The important thing is not to stop questioning. Curiosity has its own reason for existing. One cannot help but be in awe when he contemplates the mysteries of eternity, of life, of the marvelous structure of reality. It is enough if one tries merely to comprehend a little of this mystery every day. Never lose a holy curiosity.
-Albert Einstein (1879 - 1955)
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Something heppened....
Now calling [!about!] displays;
1
1
J
J
J
J
lol no idea where that is coming from.... but it is displaying something.
The important thing is not to stop questioning. Curiosity has its own reason for existing. One cannot help but be in awe when he contemplates the mysteries of eternity, of life, of the marvelous structure of reality. It is enough if one tries merely to comprehend a little of this mystery every day. Never lose a holy curiosity.
-Albert Einstein (1879 - 1955)
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
-
☆ A M B ☆
- 24,524 Posts
It looks like it’s returning everything as arrays, and only displaying the first element of the array (the first character in the string). I’ve run across that before.
Just for the record - I have that original makeArray() code working perfect.