Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hey, friends!

I'm converting a single-page site which has among other things a button that when clicked has Ajax-loading a html-page into a modal-window andi'm stuck with something i don't know how to make editable in couch in an optimal way.

The site has a portfolio that I have managed to convert to couch with the help of a repeatable with some editables inside (with image and a summary text).

Each item in the portfolio when clicked calls (with jquery.load) a html-page with more details for the portfolio-image clicked on.

There are 5 static html-files pre-made, (but of course it could be more or perhaps less) and I want to be able to edit the details inside of the couch-admin just like other fields of the portfolio and without having to have n-numbers of ready html-pages and since the portfolio-repeatable is allready defined it would be easy to add "portfolio-details" as an editable

I've been checking through the relations-examples on https://docs.couchcms.com/concepts/relationships.html
and i think that could be used to solve this, since the portfolio is in there allready ("one to one"?), but i don't know how.

What makes this a little different is the fact that it is a single-page site, so i only have an index.php-page and the index.php can not be defined as a clonable template (at least i I don't think it can be) but if im going to have an special cloenable "portfolio-details" template that is no problem i think since Ajax can load php-files also(?), and i won't be showing it in the menu of the index-page

Any hint here from somebody who has an idea of the best way to solve this would be appreciated! Please?
A small note about basic assumptions: I have never seen an `index.php` template not being able to become a clonable one. ;)
@exwp, you mentioned -
it is a single-page site, so i only have an index.php-page

Even for a single-page site we can absolutely make use of multiple templates ('index.php' can be the main 'single-page' template and others can assist in managing data input that gets eventually displayed inside the main template).

Please see the following thread that perhaps will help in clarifying the details -
viewtopic.php?f=2&t=7731

Hope this helps.
Do let us know if you have further questions regarding this.
Thank you @trendoman and @kk for you answers! :D

So... I think, basically, instead of using repeatable in index.php as i was thinking to do, to to show the porfolio (so the user can add as many portfolio-items as they need), I should better use a special (cloned?) portfolio-template in addition to the index.php?

This portfolio-template will have a loop through all the entries and it will be called and show all items from index.php?

But then I must somehow(??) be able to display a single entry when one item of the portfolio is clicked, and then use the jquery ajax load to call the portfolio-template with the one selected portfolio-item... How do I do that?
In the example link I mentioned, the child templates were specifically set as executable='0' - that was because in that case direct access to those templates (i.e. by using their links in browser) was not required.

In your case, however, we can set executable='1' (the default) and now the portfolio template and its cloned pages can be directly accessed though the browser using their usual links.

So now, the AJAX code in index.php can simply invoke those direct links and show the returned contents.

Does this help?
Working fine!!

I'm almost there now, thank you for pointing me in the right direction @kk :D

p.s: For the portfolio-filter, i'd need to get the unique categories, how do i do that :?:
I don't really understand the folder-thing so i haven't enabled pretty-urls, and using a editable text ("category") on the portfolio, but i will experiment and try if i can use them

Update; Solved it, by using

Code: Select all
<cms:folders masterpage='news.php'>
    <cms:show k_folder_title /> <br>
</cms:folders>


I hope it is ok to be using my license also for a subdomain where i will put the portfolio?
CouchCMS is a very nice tool to work with!

Another question: It seems that the category-thing works without enabling pretty-url's in my case (since it's not a blog-type of site where you'd want to go back and forth i suppose).

Is there a risque that the category-function will fail without pretty-urls? The reason i'm hesitating to use those is that there will be a more complex .htaccess on this site with access-rules etc, and i'm not sure how to modity the .htaccess for that (where to put the rules that couchcms added in relation to the access-rules)
6 posts Page 1 of 1
cron