Problems, need help? Have a tip or advice? Post it here.
15 posts Page 1 of 2
Hello,

I am new to the forums and this CMS system. I am working with it, and trying to understand it and I have to say, it is pretty easy and straight forward to convert standard websites with it.

I am having one issue that I can't work though and would love some help. I have read the thread on xml file editing, and I have also read the discussion given the photo gallery setup. I too am faced with a similar issues, but I believe my setup is slightly different, as the approach outlined in the forum thread didn't work for me (or I did it wrong).

I would like to layout the setup here and see if anyone can clarify a few things for me.

I have an html page that has a .swf object embedded in it. That object read from an xml file, designated in the html page itself, to populate the flash object with pictures and descriptions. My current site has 3 of these im place for 3 different photo galleries.

So current. html page has the error output (in the event that flash isn't detected) and a reference to the .xml file it is to read for its content.

There is an xml file where I edit the path of the image, and can add a description of the image.

I would like to make that xml file managed by couch, but am really struggling with which files get converted to .php and which stay HTML.

This is the article (viewtopic.php?f=2&t=51&view=previous) I tried to follow to implement this functionality but I am getting lost on which files become php and which files don't etc..

On one hand I can get the base html page to resolve, but there is no data/pics in it at all.

On the other hand I end up loosing access to the same page once it goes to .php

Can anyone help me understand exactly what lines go in which files, and while file types become pbp please?

I really want to start using this commercially but I feel I need to fully understand the Xml porting process before I decide to purchase.

Thanks so much in advance.

C.
Hi :)

The method discussed in the thread you mentioned (viewtopic.php?f=2&t=51&view=previous) should be relevant for your case too.

Suppose the XML file in your existing setup is named 'somefile.xml'. Since you wish to manage it via Couch, we'll need to change its extension to .php (so now the file will become 'somefile.php').

In this file you'll place the two mandatory PHP statements *plus*, because its output will be XML, you'll also need to add the cms:content_type tag immediately after the opening statement. So now the contents of the file should look like -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:content_type 'text/xml' /><cms:concat '<' '?xml version="1.0" encoding="' k_site_charset '"?' '>' />

.. your existing XML content ..

<?php COUCH::invoke(); ?>

After visiting 'somefile.php' in the browser you should see it listed in the admin sidebar which would mean that the file is now registered with Couch and we can begin using Couch tags (including cms:editable) within it.

Of course now since the name of the XML file has changed (the .xml has become .php), you'll need to replace the original name with the new name everywhere it is used in your original JS code.

This might not work if your original code accepts only files with .xml extension (it could very well work also so you need to test first).

In case it does not work you can to do the following -

Place the following line in your .htaccess file -
Code: Select all
RewriteRule ^somefile\.xml$ somefile.php  [L]

Now you can use the file name with .xml extension (as was done in your original setup).
Internally, this will get resolved to the php file.

Hope that clears up things.
Please let me know.
Wonderful explanation.

Very clear, I will test it this evening when I work on that site and let you know.

Thank you so much.
OK, so now I am facing a new error and it seems to not be able to find the cms.php file.

It is worth mentioning that I have the website root with all my html pages in it. Then I have a 'gallery' subdirectory with my xml, pictures, and gallery html files in it.

It seems that it is looking for the cms.php file INSIDE the gallery folder. Should I move my gallery folder contents into the root, or is there some way to modify line 1 of the newly formatted php. I prefer the subdirectory approach for security reasons as thier are uploaders that do not have access to anything but that pictures folder.

Below is the exact error message I get.

Code: Select all
Warning: require_once(backend/cms.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/59/8615059/html/some_site/gallery/somefile.php on line 1

Fatal error: require_once() [function.require]: Failed opening required 'backend/cms.php' (include_path='.:/usr/local/php5_3/lib/php') in /home/content/59/8615059/html/some_site/gallery/somfile.php on line 1
For templates that are in sub-folders (i.e. not in the site's root) you need to modify the first statement to specify the correct path to the 'couch' folder e.g. as follows for first-level subfolder (as in your case)
Code: Select all
<?php require_once( '../couch/cms.php' ); ?>

For a template nested two folders deep from the root, the path would become -
Code: Select all
<?php require_once( '../../couch/cms.php' ); ?>

Hope it helps.
Dur, I just realized I forgot my ../ in my relative path... sry..

Noob here.. lol
Ok.

That worked great and althought i can now edit the xml portion of my site the editor keeps closing tags that don't need to be closed. I have reference coded in the xml as follows...

Code: Select all
<photo desc="Double Click to open and close a larger image." url="_pics/pic01.jpg" />


When I open the page on the couch editor it is blank with a ton of photo tags in the bottom of the editor. If I open the source I can see my text and chagnge it there, but the minute I hit save, it will auto append one </photo> entry for every line, despite these being self cosing tags, which breaks the page as the object can't interpret a closing tag of this type.

I will keep digging though the tags and such for couch to find a solution, but would appreciate it if anyone had any ideas or things to try for me.

Thanks again KK, you have got me further down the rabbit hole than I could on my own. :)
Instead of directly editing the XML file's code, it is preferable to 'generate' the code.

As was done in the original thread you mentioned - it used a separate template to upload only the images (you can also use 'repeatable-regions' if you like). Then in the XML template it used cms:pages to loop through the uploaded images and generate the XML tags.

For example using the following in the XML template (assuming the accessory template for uploading images is 'photos.php' with a type 'image' editable region named 'photo') -
Code: Select all
<cms:pages masterpage='photos.php' >
    <photo desc="Double Click to open and close a larger image." url="<cms:show photo />" />
</cms:pages>
OK, I am completely lost here. I have read the info on the pages and templates and its about as clear as mud.

Is there anyway I could make a contribution in some way to get some 1 on 1 assistance with understanding what is to be done here?

I am really struggling with the pages and templates specifically. I have made a couple of pages with editable areas with no issue at all. I even got the xml file editable and the flash object reading it properly, but this is over my head. :(
Can you please post the XML template here?
Thanks.
15 posts Page 1 of 2