Alright so I have a flash website that refers to a .xml file to get the content.
I want to use MODx backend to modify the file that the flash is looking at and I’ve looked around and it seems like this shouldn’t be too hard but I’m stuck on a few things.
* How do I get MODx to update a file? Don’t I need to update the "content.xml" file with any changes done using the editor?
What I’d envision is that I’d basically go into the .xml file and put references to chunks, snippets, page’s content.
But I’m not exactly sure how to get MODx to write back to that file so I feel like I have to understand that before I can really do anything.
Using friendly url’s, create a document in MODx and get the alias of content.xml (use the extension) and set the content type to xml and use a blank template. I start with putting a copy of the sample xml in the content. See if that works first. Then slowly use Ditto to create the same structure as your xml file.
DropboxUploader -- Upload files to a Dropbox account.
DIG -- Dynamic Image Generator
gus -- Google URL Shortener
makeQR -- Uses google chart api to make QR codes.
MODxTweeter -- Update your twitter status on publish.
Quote from: stormlifter at Oct 12, 2009, 10:21 PM
Or do I edit the flash file and point it to an address where the alias file is?
The site tree in MODx manager are "fake" folders (containers)! When turning on
FURL,
what happens when you request [
http:// ... /folder/somename.xml ] or [
http:// .../somename.xml ] is that MODx [
index.php?q= ] go look in the database for
the page where the content is stored. So somename.xml has been rewritten by htaccess mod rewrite.
alias is pointing to a docID. You can serve
text/html - E.g. [
.html ]
text/css - E.g. [
.css ]
text/javascript - E.g. [
.js ]
text/xml - E.g. [
.xml |
.rss ]
text/plain - E.g. [
.txt ]
More one’s can added in Tools -> Configuration -> Site tab
application/x-httpd-php - E.g. [ .php ] //The PHP needs to be in a snippet.
...I’m
just using text/html - is that working fine thanks to "AddHandler php5-script .php" in htaccess!? I don’t know!
(This is of course limited to what is runnable on the server/browser.)
So... alias -> somename.xml , template -> blank , content type -> text/xml (FURL enabled)
Nice!
Now I probably should start a new thread, but I’ll try putting in here.
Lets say I have a TV of type Image so that someone can edit what they think is the "About Me" page to add a picture of themselves. I have a TV now [*AboutImage*], but I can’t use that on the page that the xml is in because that TV doesn’t belong to that page.
Will I have to put all the TVs I want to use on the page that has the xml? Or is there a way to bisically "[[GetField]]" someway and pull TVs from another page.
If I can do that then maybe I can do... on a page that has multiple images...
for ( i=0, i+1, [[GetField [*PageImage#*]]) // Basically I’d name the TVs iteratively. [*PageImage1*], [*PageImage2*]
// do my xml stuff in here and put the images into the format needed for the xml
// this would loop until there weren’t any more images.
Maybe this isn’t the best way though because it wouldn’t allow someone who can only edit pages to add more images than there are TVs for. Is there maybe a way you can think of for my situation that would allow the number of images to expand as needed? For example a "this is what I’ve done" page may have 10 images this month and 12 the next.
Thanks a bunch!
EDIT: I love MODx. I was able to figure something out really quick. Based on the tutorial there. I basically made containers and then just looped through them grabbing their TVs (with images) and the content as the description for the image.
//based on -->
http://modxcms.com/learn/solutions/flash-cms.html
You can use TV’s if you instead of template -> blank
create a new template:
my-xml-template
<?xml version="1.0" encoding="UTF-8" ?>
[*content*]
Then on the
my-xml-page.xml using
my-xml-template
<rss>
<channel>
<item id="[*id*]">
<title>[*pagetitle*]</title>
<shortDes>[*introtext*]</shortDes>
<image>[*image_1*]</image>
<image2>[*image_2*]</image2>
<image3>[*image_3*]</image3>
<description>
<![CDATA[ Hi Hello! ]]>
</description>
</item>
</channel>
</rss>
Then create 3 image tv’s:
image_1,
image_2,
image_3 and assign them to
my-xml-template
Now when you edit
my-xml-page.xml you see the extra input fields.
//id, pagetitle and introtext are all default
document objects
when using a Ditto chunk tpl you call both TV’s and Document objects with [+...+] instead of [*...*]
Good tut for basics -->
http://net.tutsplus.com/tutorials/other/working-with-a-content-management-framework-modx/