Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hi,
This seems to be a weird issue. Whenever I make any content changes within a template in Admin panel, the entire page is gone from the public page. I'm developing a single page website wherein for each section, I'm using a <cms:pages> node to segregate and manage content through the admin panel.

For example, the below code screenshot shows a section called 'Services' which has a separate page 'services.php'
img1.PNG
img1.PNG (37.63 KiB) Viewed 1097 times


This is the services.php page.
img2.PNG
img2.PNG (56.25 KiB) Viewed 1097 times


This is the admin panel page where I manage the content of Services section
img3.PNG
img3.PNG (55.21 KiB) Viewed 1097 times


Whenever I make a change in admin and save, the entire page section is gone. I tried viewing before and after login. Tried viewing the services.php page first with and without login, but no luck. The specific section is gone missing. I'm not sure if anyone else faced this issue.

Kindly help with your suggestions.

Thanks
Hello. Any suggestions people?
Kindly help with this.
Hi,

I think the problem is this -
You are defining type richtext editable region 'services_content' inline (i.e. right at the place where you'll show the content in the template) as follows -
Code: Select all
<cms:editable name='services_content' order='2' type='richtext' label='Services Content'>
    <p class="lead animate-this">We are a media firm ... ... </p>
</cms:editable>

Please take a look a the enclosed content that will be editable in CKEditor - the <P> has very specific classes 'lead animate-this'. Now take a look at the CKeditor image you posted - it does not show the classes anywhere (which is obvious because it is a WYSIWYG editor).

Problem with making contents having specific classes or IDs like this is that when the use edits the content and saves, CKEditor is likely to discard the classes and save its own generated HTML markup (unless the user chooses to edit the content in the 'source' view, which is highly unlikely).

Once the class is gone, your content loses its original look (or maybe even disappears depending on your CSS styles).

With the problem understood we can discuss the solution.
The solution is to make only the plain text editable (i.e. leave the classes, IDs uneditable).

I am sure you know, if you have gone through our Aurelius tutorial, that there are two ways of defining an editable region. You are using the 'inline' method. Let us use the second method of defining the region with the <cms:template> block.

Now your definition becomes as follows -
Code: Select all
<cms:template title='Services Section'>
    <cms:editable name='services_content' order='2' type='richtext' label='Services Content' />
   
    .. you may define other editable regions also here ..
   
</cms:template>

And the point where you want to display the content, we use this -
Code: Select all
<p class="lead animate-this"><cms:show services_content /></p>

As you can see, no matter how the user edits the contents, the classes will not be disturbed.

Please try this approach and let me know if this helps.

P.S. please post any code you have in text form and not as image (I had to manually type the code looking at your image).
Thanks.
Thanks for the response KK.
Regarding the richtext, I'll try updating the content as per your suggestion. On the other hand, the same behavior is happening in page where there are no rich text editors. Below is the code from 'home.php' template, where there are no richtext content.

Code: Select all
<?php require_once( 'admin/cms.php' ); ?>
<cms:template title='Home Page' />
<!-- CMS Editable fields - Start -->
<!-- Home Section - Start -->
<cms:editable name='site_title' order='0' label='Title'
            desc='Enter the Website Name to be displayed'
            type='text'>TestSite</cms:editable>

<cms:editable name='site_subtitle' order='1' label='Sub Title'
            desc='Enter the Website subtitle to be displayed in Home Section'
            type='text'>Test Text</cms:editable>

<cms:editable name='banner_type' order='2' label='Banner Type'
              desc="Type of Banner to be displayed"
              opt_values='Animation | Image | Video'
              type='radio' />

<cms:editable name='facebook_id' order='3' label='Facebook Link'
            desc='Enter the Facebook Page link'
            type='text' />

<cms:editable name='twitter_id' order='4' label='Twitter Link'
            desc='Enter the Twitter Page link'
            type='text' />

<cms:editable name='instagram_id' order='5' label='Instagram Link'
            desc='Enter the Instagram Page link'
            type='text' />
<!-- Home Section - End -->         
<!-- CMS Editable fields - End -->
<?php COUCH::invoke(); ?>


And below is the code inside another php file (within Index.php, which is the public facing page).
Code: Select all
  
<cms:pages masterpage='home.php' >
      <cms:if banner_type = 'Video' >
            <section id="homeNoBg">
         <cms:else />
            <section id="home">
         </cms:if>

         <div class="overlay"></div>

         <div class="home-content-table">
         <cms:if banner_type = 'Animation' >
               <div id="particles-js"></div>
            <cms:else />
               <cms:if banner_type = 'Video' >
               <div class="fullscreen-bg">
                  <video loop muted autoplay poster="assets/banner/videos/videoframe.png" class="fullscreen-bg__video">
                     <source src="assets/banner/videos/Home_work.webm" type="video/webm">
                     <source src="assets/banner/videos/Home_work.mp4" type="video/mp4">
                     <source src="assets/banner/videos/Home_work.ogv" type="video/ogg">
                  </video>
               </div>
               <cms:else />
                  <cms:if banner_type = 'Image' >
                     <!-- <div id="slider" class="slider">
                        <div class="slItems">
                           <?php
                              foreach(glob('assets/banner/images/'.'*.*') as $file) {
                                 echo '<div class="slItem" style="background-image: url(\'' . $file . '\');"></div>';
                              }
                           ?>
                        </div>
                     </div> -->
                     <div></div>
                  </cms:if>
               </cms:if>
            </cms:if>

            <div class="home-content-tablecell">
               <div class="row">
                  <div class="col-twelve">                  
                     
                           <h1 class="animate-intro"><cms:show site_title /></h1>
                           <h3 class="animate-intro">
                              <cms:show site_subtitle />
                           </h3>   
                           <div class="more animate-intro">
                              <a class="smoothscroll button stroke" href="#about">
                                 Learn More
                              </a>
                           </div>                     

                     </div> <!-- end col-twelve -->
               </div> <!-- end row -->
            </div> <!-- end home-content-tablecell -->          
            </div> <!-- end home-content-table -->

            <ul class="home-social-list">
            <li class="animate-intro">
                  <a href="<cms:show facebook_id/>"><i class="fa fa-facebook-square"></i></a>
            </li>
            <li class="animate-intro">
                  <a href="<cms:show twitter_id/>"><i class="fa fa-twitter"></i></a>
            </li>
            <li class="animate-intro">
                  <a href="<cms:show instagram_id/>"><i class="fa fa-instagram"></i></a>
            </li>        
         </ul> <!-- end home-social-list -->   

            <div class="scrolldown">
               <a href="#about" class="scroll-icon smoothscroll">      
               Scroll Down            
               <i class="fa fa-long-arrow-right" aria-hidden="true"></i>
               </a>
            </div>         
      
      </section> <!-- end home -->
   </cms:pages>


After making any changes, the entire content within <cms:pages> tags disappears. Below is the screenshot of page source rendered in browser.

img5.PNG
img5.PNG (33.59 KiB) Viewed 1083 times


Here is the screenshot of my index.php file containing multiple pages, for your reference
img4.PNG
img4.PNG (37.34 KiB) Viewed 1083 times


Please let me know if I'm missing something here.
If your site happens to be online, please PM me the FTP + Couch super-admin creds and I'll take a look at the issue.
Ok, I had a look at your site and my findings are as follows -

1. You have modified a core template file (theme/_system/group_advanced_settings.html) directly to remove the advanced-settings dropdown from the edit screens.

2. This has the side-effect of marking as 'unpublished' every page that is saved (because the date field in advanced setting is now gone missing).

3. <cms:pages> tag ignores unpublished pages by default.

I think you can see now why your sections keep disappearing.

While making direct changes to core files is a big no no (you should override them), the method you have chosen to remove the advanced settings dropdown is also faulty - you should have used CSS to set its visibility to none.

Anyway, the way things stand at the moment, you can ask <cms:pages> to show even unpublished pages by adding the 'show_unpublished' param as follows -
Code: Select all
<cms:pages masterpage='services.php' show_unpublished='1'>

Hope this helps.
Thanks for the response KK.

Now I understand why it was working earlier, but now. I'd revert the core change back and handle the case through CSS instead. This particular change didn't crossed through my mind and I was searching elsewhere on finding out the reason.

Thank you for your prompt support in identifying the issue.
7 posts Page 1 of 1