Multiple Pages - How to access via sitecake

#1

Hi,
I have just downloaded SC and it worked once I had made the changes to the first page.
Now I need to make other pages editable with SC.
I have added the pages themselves to the config.php file which is fine and I can access that page in edit mode if I append ?page=page1.php to the end of the sitecake.php URL, again all fine.

However, my clients don’t really 1, know how to add this bit to the URL 2, want to do this manually for each page.

Is there any way of having a menu page which shows all the pages which are configured for SC management?
Could I just write a static page with redirects that does this append to the sitecake.php URL?
It would be nice if I could use the value from the array of configured pages from config.php to do this so that as a developer I add new page to site, add this page to the list within config.php and it updates this menu.

Any other suggestions or ways of doing this?

Many Thanks
Dave

#2

Hi Dave / @tidderd

I had kind of same issue. So I added an “edit” link in my footer. End-users can now simply click Edit.

<p align="right"> <?php $pageName = basename($_SERVER['PHP_SELF']); ?> <a href="sitecake.php?page=<?php echo $pageName; ?>">edit</a> </p>

To complete the story I have the footer in a footer.inc file (like the header) and include this in all my pages. So I only have one file to maintain header and footer.

#3

Hmm… I see that this editor converted the underscores to italic.
It should be $_SERVER['PHP_SELF']:

<p align="right"> <?php $pageName = basename($_SERVER['PHP_SELF']); ?> <a href="sitecake.php?page=<?php echo $pageName; ?>">bewerken</a> </p>
#4

All the links on the page to another local pages should be converted to edit links by sitecake while in edit mode, except the ones that are inside editable (sc-content) containers. Also you could mark your menu with sc-nav class so that sitecake is aware of menu links.

#5

Hi,

I wrote a separate page called - sitecakemenu.php
This pulls the $app[‘site.default_pages’] value out of the sitecake config.php file.
This is put into a foreach loop as part of a ul/li list within the page;

This is the list of editable pages within Sitecake;

    <?php $links = $app['site.default_pages']; foreach($links as $k => $v) { echo '
  • ' . $v . '
  • '; } ?>

This means that as the developer I only have to add the actual new page to the site with <div class='sc-content’>

elements in it as required by client, then add that page to the config.php - $app[‘site.default_pages’] variable.
$app[’site.default_pages’] = [‘index.html’, ’newpage.html’];

I will most likely make the ‘sitecakemenu.php’ into the dashboard for administrating the overall site to include site hit graphs etc

I also use header and footer via includes as it makes editing these easier, and generally the client does not make changes to these or add pages too often, it’s the content of the main pages that changes with user updates etc.

Many Thanks

Since writing the original reply to this I have amended that further;

<?php $links = $app['site.default_pages']; foreach($links as $k => $v) { echo '
  • ' . $k . '
  • '; } ?>

    $app[’site.default_pages’] = [‘Index’ => ‘index.html’, ‘New Page’ => ’newpage.html’];

    As this actually shows the editor user a ‘friendly’ name for each page rather than the actual full file name.
    Again I am going to make this into a Admin Dashboard at some point

    Thanks

    #6

    $app['site.default_pages']; config variable is not for that use. That should be list of default pages (eg. index.php or index.html) which Sitecake uses to determine what page it should process if no page parameter is passed, or if address passed in page parameter doesn’t contain file name (eg. sitecake.php?page=/about).

    By default, Sitecake is handling all the pages under site root (where sitecake.php and sitecake dir are stored) and it’s subfolders. If you want to exclude any file or directory under site root use .scignore file by adding each excluding file/dir in new line of that file. .scignore file should be stored in site root.

    So, to conclude…

    change back ‘default_pages’ parameter to
    $app['site.default_pages'] = ['index.html', 'index.htm', 'index.php', 'index.php5'];
    if you are having plain html site, and Sitecake should turn all your internal links to editable links (eg. about.html => sitecake.php?page=about.html). Links inside sc-content containers won’t be translated.

    If there is a page that is not linked in any other page, you have to access it through address bar directly or if it’s a php site, you can check for session to see if site is in edit mode or if current page is ‘sitecake.php’.
    There is also a way to check if you are in edit mode from javascript if you want to add extra link to page, but your site is plain HTML (http://sitecake.com/docs/using-javascript.html).

    #7

    Ok, so just to be clear before I buy. I can edit multiple pages by using sc-nav on my menu, and navigate to the pages in edit mode? Suggestion. It would be nice if the demo had multiple pages to illustrate how that works.

    #8

    Hi, that’s right. As for your suggestion, thanks, we’ll consider uploading template with multiple pages to https://sitecake.com/templates.html so people can test it.

    #9

    Will make a demo with multiple pages, but once the page manager release becomes public. It’s still best test release. :frowning:

    #10

    Is there already a demo page with multiple pages and a menu?

    #11

    Yes. It’s on our website

    https://sitecake.com/demo

    You can check it out.