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

How do I dynamically remove a cloned page?
Let's say I have something like:

Code: Select all
<cms:pages masterpage="blog">
    <cms:if a==b>
        Delete this page
    </cms:if>
</cms:pages>


How would I go about this without exposing my website and making it's contents vulnerable?
Is using
Code: Select all
<cms:db_delete masterpage=k_template_name page_id=k_page_id />
safe ?

Also, how would i edit an editable region to change it from pending to active when b == c ?
Changing an editable region solved:
Code: Select all
                <cms:db_persist
                    _masterpage=k_template_name
                    _mode='edit'
                    _page_id=k_page_id
                    state="Active"
                />


Thank you very much !
To delete a page, use db_delete tag:
viewtopic.php?p=13980#p13980

For activating a page:
viewtopic.php?p=17619#p17619

publish:
Code: Select all
<cms:db_persist
   mode="create"
   masterpage="blog.php"
   page_id=k_page_id
    k_publish_date="<cms:date format='Y-m-d' />"
/>

unpublish:
Code: Select all
<cms:db_persist
   mode="create"
   masterpage="blog.php"
   page_id=k_page_id
    k_publish_date="<cms:date format='0000-00-00 00:00:00' />"
/>
Sorry, Alin. I posted incomplete code earlier. You need to tell the db_persist tag which page to make changes to. I corrected the code in the post above.
tim wrote: Sorry, Alin. I posted incomplete code earlier. You need to tell the db_persist tag which page to make changes to. I corrected the code in the post above.


Hey @tim, thank you for your answer but I think you got the second question wrong, I knew how to publish a page, the thing is that inside a page i have an EDITABLE REGION that I want tho change, the editable region contains the word Pending and I want to change it to Active.

Like this :

Code: Select all
<cms:editable name='changing_state' type='text' >Pending</cms:editable>


I'll try that code and see if I cad use the editable region instead of the page date and change that. :-? Will be back

EDIT:

I've tried something like:

Code: Select all
   <cms:db_persist
                   mode="create"
                   masterpage='schedule.php'
                   page_id=k_page_id
                    state="Active"
                />


But when I visit the page, I keep getting
Code: Select all
ERROR: Tag "db_persist": '_masterpage' attribute missing


EDIT2

Changed the above code to:

Code: Select all
                <cms:db_persist
                    _masterpage=k_template_name
                    _mode='create'
                    page_id=k_page_id
                    state="Active"
                />


I'm not getting the error anymore but the editable region doesn't change.

WORKING VERSION

I mistakenly used create mode instead of edit mode..this works:

Code: Select all
                <cms:db_persist
                    _masterpage=k_template_name
                    _mode='edit'
                    _page_id=k_page_id
                    state="Active"
                />
Sorry about my sloppy advice, Alin. :oops: God job getting it working!
5 posts Page 1 of 1
cron