Install getField snippet and make a document that uses blank template and runs a snippet that has this code in it:
return $modx->runSnippet(’getField’, array(’docid’ => $_GET[’docid’], ’field’ => ’content’));
Then you can get the content from some document using url: yoursite.tld/thepage.html?docid=23
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
thanx, Doze
that was it. Should be part of core installion, isn’t it? something like [[content, id=xx, id=xx, ...]] and page.html?tag=content or something like this ...
(please forget about a former comment of mine, I misunderstood your suggestion first)
Anyway it works fine with your call "yoursite.tld/thepage.html?docid=23" even with the syntax "[~50~]?docid=27".
But
if I put it into a js call like "<a href="javascript:getContent(’[~50~]?docid=27’);">Ajax Link</a>" the script works correctly but the output is a sql error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’html) AND sc.published=1 AND sc.deleted=0 ) AND (sc.privatew’ at line 3 »
SQL: SELECT DISTINCT sc.parent FROM `usr_web325_1`.`ion_site_content` sc LEFT JOIN `usr_web325_1`.`ion_document_groups` dg on dg.document = sc.id WHERE (sc.id IN (27.html) AND sc.published=1 AND sc.deleted=0 ) AND (sc.privateweb=0) GROUP BY sc.id LIMIT 1
What can I do about that?
I would check out your getContent javascript, because on first glance it appears to be appending .html to your docid (either on its own or in conjuction with MODx’s URL rewriting) and thus crashing the SQL query.
Exactly that was the point. I had to modify the call of the script I implemented a couple of days before, thanx ZAP. Looking foreward to some free time around Easter.