Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
One-Page-Template-> automatically include new pages in a div
#10
(2012-04-14, 19:42:59)Carlos Wrote: A way to have a one-page site with anchors (for GS 3.1):

Insert this code in your template (e.g. before, after, or instead of the <?php get_content(); ?> tag).
Code:
<?php
global $pagesArray;
$pagesSorted = subval_sort($pagesArray,'menuOrder'); // or 'title', 'menu', 'url', ...
foreach ($pagesSorted as $page) if ($page['url']!='index' && $page['menuStatus']=='Y') {
    $pag = $page['url'];
?>

<a name="<?php echo $pag; ?>"></a>
<div class="pagecontent <?php echo $pag; ?>">
    <h2><?php getPageField($pag,'title'); ?></h2>
    <?php getPageContent($pag); ?>
</div>

<?php } ?>
Edit what you need to customize the output (remove the <h2> line if you don't want titles, etc.)

Then go to Admin > Settings and set your Custom Permalink Structure to:
Code:
#%slug%

All pages (but index) that have been added to the menu will be displayed in the home page.

The div's will have class="pagecontent SLUG" so that you can style them (of course you can edit that in the script, if you don't want it this way)

You have helped many people by this post, that's nice.

Now I'm wondering how to do horizontal OnePage web, i.e. the same as this but it would scroll the pages horizontally, so they'd be next to each other, not one below another. Is that possible somehow?

The problem I actually have in my imaginative mind is that I would need the page to load 6 times for 6 pages and it would be always the whole web. I had looked up many tutorials how to do this, but it's all about static websites where you can simply put down everything you need so I'm still missing some part.

I also had an idea to make a half-static template where would be the template like 6 times (for six pages) repeateadly below but it would always load the same page in all divisions. Is there some way in this direction that would lead me to the succesful end? Of course I would like some better solution, but if this way led somewhere, it would be still better than nothing.
To have different content on every page I used <?php getPageContent('slug'); ?>, but I can't use the News Manager if I use getPageContent, I get a blank page - logically.

To be clear what I want is something like this

If anyone had some suggestion, I would appreciate that. Thank you
Btw, I tried four different working jQuery horizontal-scroll javascripts and none worked on GetSimple, it was never scrolling slowly and smoothly, it just flashed and I was there as if there was no script, however, I double checked that and also tried without all the plugins. Is there anything that could interrupt that?
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply


Messages In This Thread
RE: One-Page-Template-> automatically include new pages in a div - by TeeJay - 2013-05-10, 18:40:01



Users browsing this thread: 1 Guest(s)