Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
this is a little long winded but hopefully you can help me.

basically I have the index page set up as one long scrolling page and when the user clicks on a link it scrolls to that part of the page.

Now to make it easier for the client to update the sections of the index page, I thought this would work.

Each section of the index page(about us, welcome,contact us etc) is a page held in the snippet folder and embeded into the index page. I then give each snippet page a template name so that is shows up in the admin panel.

I have set the index page as hidden, so the client can't see that and wanted it so the client updates the snippet page listed in the admin panel to update each section of the index page.

I thought this was working fine until I tried to update the site using the snippet pages.

The problem I have is that the site does not update unless the snippet page is refreshed in the browser.

Now to get the client to do this each time will be confusing for him, as the filepath to the snippet page is not simple and it will confuse him.

Is there a way to update the snippets without refreshing them in the browser?

I am 95% the way throught he site build and have only just realised this. I really dont need to be strating again

Any help greatly appreciated
Can you please post in relevant sections of your index.php showing how you have incorporated the snippets?
Also please post one *complete* snippet.

Thanks.
I have incorporated the snippets like this

I call the couchcms at the top of the index page with

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template  order='100' hidden='1'/>



and then embed the relevant sections like this
Code: Select all
<!-- Fixed navbar -->
<cms:embed 'menu.html'/>
    
<!-- Begin page content -->
<div class="divider" id="section1"></div>
<cms:embed "welcome.php"/>


heres is a sample snippet page

Code: Select all
<?php require_once( '../cms.php' ); ?>
<cms:template title='Welcome Page' order='2'/>
<div class="row">
   
   <div class="col-sm-6">
                <cms:editable name="welcome_text" type="richtext">   
         <div class="page-header">                          
         <h1>Welcome</h1>
         </div>      
         <p class="">First for low cost BMW and Adventure motorcycle rentals in </p>
         <p class="">Established 10 years.</p>
         <p class="">Latest models BMW bikes available with new Triumph and Honda models added.</p>
         <p class="">Discounted Group Pricing and Accomodation packages available.</p> 
      </cms:editable>
   </div><!-- /col -->
</div><!-- /row-->   
<div class="divider"></div>      
<hr>
<?php COUCH::invoke(); ?>



if I update the index page in the admin panel it works, but that is hidden from the client. If I refresh the snippet page in the browser, then that also works, but that would confuse the client. If I update the snippet page in the admin panel and refresh the index page, then the page does not update
Thanks. That confirms what I was suspecting - you are trying to use snippets as bonafide templates.

Please do the following (I'll take the example of only 'welcome.php' here. It applies to all your sections) -
1. Move your welcome.php from the snippets folder into your site's root (i.e. where your 'index.php' resides).
You'll have to modify the require_once statement to reflect the new path.

2. Make this template non-executable as follows (by doing this normal visitors won't be able to access this template through browser)
<cms:template title='Welcome Page' order='2' executable='0' />

3. Visit the template as super-admin to register it. It will appear in the admin sidebar.

4. Finally to incorporate the values inputted in welcome.php into index.php, use the following in index.php -
Code: Select all
<cms:pages masterpage='welcome.php' >
    <cms:show welcome_text />
</cms:pages>

Repeat the steps for all your sections.

This is the right way to implement a one-page template.
If you need, you can see one more example of it being discussed here - viewtopic.php?f=2&t=8051

As a side-note - since now welcome.php is gone from the snippets folder, the previously registered instance of it is orphaned. You can delete it form the admin-panel.

Hope this helps.
I have lost any embeded images and all formatting from the welcome page now(I had removed all that when i posted the snippet so it didnt confuse). Do I have to put all of that into the index page?


the original full snippet page looked like this

Code: Select all
<?php require_once( '../cms.php' ); ?>
<cms:template title='Welcome Page' order='2' executable='0'/>
<div class="row">
   <div class="col-sm-2 col-sm-offset-2"><br/><a href="index.php"><img class="img-responsive" src="/images/site/logo.png"/></a></div>
   <div class="col-sm-4">
      <div class="page-header">
         <h1><cms:editable name="welcome_title" type="text">Welcome</cms:editable></h1>
      </div>
      <cms:editable name="welcome_text" type="richtext">      
         <p class="">First for low cost BMW and Adventure motorcycle rentals</p>
         <p class="">Established 10 years.</p>
         <p class="">Latest models BMW bikes available with new Triumph and Honda models added.</p>
         <p class="">Discounted Group Pricing and Accomodation packages available.</p> 
      </cms:editable>
   </div><!-- /col -->
   <div class="col-sm-2"><br/><br/><a href="/pdf/Fly-Ride.pdf" target='_blank'><img class="img-responsive" src='/images/site/new_ride_logo_en.png'/></a></div>
</div>   
<div class="row">
   <div class="col-sm-10 col-sm-offset-1">
   <hr>
   </div><!-- /col -->
</div>
<div class="row">
   <div class="col-sm-5 col-sm-offset-3">
      
      <cms:editable name="welcome_rental_locations_text" type="richtext">      
      <h4>Motorcycle rental stations are in Madrid, Barcelona, Bilbao, Seville, Malaga, Faro and Morocco.</h4>
      <p class="">Bike collection at Airport and Hotel available.</p>
      <p class="">Collect bike in one location and drop off in another to all these locations.</p>
      <p><h4>Motorcycle rentals Spain - Whats included in your rental price:</h4>
      <ul>
         <li>Side cases (BMW or Touratech) with Top case</li>
         <li>Insurance (fully comprehensive with credit card retention)</li>
         <li>Unlimited mileage for 7 days rentals or more</li>
         <li>300 km included per day. extra km &euro; 0,30 per km.</li>
         <li>Airport transfers (Malaga)</li>
         <li>All taxes</li>
      </ul></p>

      <h4>Motorcycle rentals Morocco - from Marrakech - Casablanca- Fez - Tour Guide Optional</h4>
      </cms:editable>
   </div><!-- /col -->
   <div class="col-sm-2"><br>
      <img src='/images/site/new_map2.png'/>
   </div>
</div>   
   <div class="divider"></div>      
<hr>
<?php COUCH::invoke(); ?>


now the images dont show and the text formatting has gone and the second editable area is not visible either
Scrtatch that, I worked it out for myself.

I had to move the non editable text to the index page and then call the cms:show for each editable ragion on the page
6 posts Page 1 of 1
cron