Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
One-Page-Template-> automatically include new pages in a div
#1
Hey,
i want to make a Onepagesitetemplate for Get Simple,
However I would like to automatically add new pages inside of a div tag to the template instead of manually adding them by editing the Template.

Can someone point me into the right direction?
Reply
#2
All of the pages? Only some? (Which ones?)
Sorted by?
Reply
#3
have a look there :
http://get-simple.info/forum/topic/3753/...der-theme/
it's exactly what i've done
Reply
#4
@ carlos
Yes all Pages

@didou
will have a look


EDIt:
http://get-simple.info/forum/misc.php?it...download=1 is this the hole function?
Ill have a look at it. May I ask some questions if i dont get it? I'm not too good in php
Reply
#5
yes it's the main function to get content in different div.

This is adapted for my template, so you have to modify it for yours.

I can help you if you need help.

ps: this function is not very optimized
Reply
#6
I will have a look at it in a few days, what I did see at first glance that you have to outputs. one for index and one for the rest.

I dont need all this, in addition you metionend that some plugins didnt work, do you have any idea why? I would like to prevent this
Reply
#7
I think plugins don't work because I've separate content and create anchor for each div for the menu.
Perhaps there is a best solution like don't separate content like i've done, not sure.

You have many other things to think, like the metas (description and keywords). You will need to create a special function to get the header for each pages included in your div otherwise you'll have only the meta from the index page (main page).

I stopped the development of my theme, but the next week-end I will have much time to continue and find solutions.
This will surely help one another and find all of the guiding ideas for a theme like All In One Page.

we keep in touch Wink
Reply
#8
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)
Reply
#9
Amazing Carlos! THANK YOU VERY MUCH
Reply
#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
#11
Sorry for the delay, I hadn't noticed your post (also, I've been offline for a few days).

In principle it is possible. The script to generate the markup you need (or the one for the demo in the link you posted) is not difficult to do. It would be similar to that one I posted.

But... News Manager (or other plugins that insert dynamic content) will not work with this special anchor-based permalink structure.
Reply
#12
(2013-05-21, 03:11:20)Carlos Wrote: Sorry for the delay, I hadn't noticed your post (also, I've been offline for a few days).

In principle it is possible. The script to generate the markup you need (or the one for the demo in the link you posted) is not difficult to do. It would be similar to that one I posted.

But... News Manager (or other plugins that insert dynamic content) will not work with this special anchor-based permalink structure.
It's okay. I have already put it on the back burner. Maybe I'll come back to it later. Thanks for your help.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#13
Carlos, I'm just creating a one-page website using your PHP code and I occurred a problem - pages which are not in the menu are not shown at all. My setting is menuOrder.
Is there a way how to show also the pages which are not actually in the menu? Thanks you.

I got a solution by adding the page in the menu, setting display:none for the menu item. Obviously, I don't want to go this way.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#14
(2013-07-11, 20:07:50)TeeJay Wrote: Carlos, I'm just creating a one-page website using your PHP code and I occurred a problem - pages which are not in the menu are not shown at all. My setting is menuOrder.
Is there a way how to show also the pages which are not actually in the menu? Thanks you.

I got a solution by adding the page in the menu, setting display:none for the menu item. Obviously, I don't want to go this way.

I suppose that if you change the foreach line to:
Code:
foreach ($pagesSorted as $page) if ($page['url']!='index') {
it should work as you expect.

PS maybe it would be convenient to change this so that it doesn't display private pages.
Reply
#15
(2013-07-11, 23:24:49)Carlos Wrote:
(2013-07-11, 20:07:50)TeeJay Wrote: Carlos, I'm just creating a one-page website using your PHP code and I occurred a problem - pages which are not in the menu are not shown at all. My setting is menuOrder.
Is there a way how to show also the pages which are not actually in the menu? Thanks you.

I got a solution by adding the page in the menu, setting display:none for the menu item. Obviously, I don't want to go this way.

I suppose that if you change the foreach line to:
Code:
foreach ($pagesSorted as $page) if ($page['url']!='index') {
it should work as you expect.

PS maybe it would be convenient to change this so that it doesn't display private pages.

Thank you. That could have occurred to me, it's relatively obvious.
I'll try it soon and I'll use it in all the one-page websites. I'm sure your solution is right Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#16
Carlos..can You help?
http://get-simple.info/forums/showthread...0#pid43600
there is any way to sort with foreach in front-end pages with I18N plugin ?
please help with this one page template
user plugin: scroll to top
Reply
#17
Here's a modified version of the script, that works (for me) with I18N Gallery when using the (% gallery ... %) placeholder.

- If you don't have a functions.php file in your theme, create one with this content:
Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }

- Insert this in the functions.php file:
Code:
$content = '';
$pagesSorted = subval_sort($pagesArray,'menuOrder'); // or 'title', 'menu', 'url', ...
foreach ($pagesSorted as $page) if ($page['url']!='index' && $page['menuStatus']=='Y') {
    $pag = $page['url'];
    $content .= '
<a name="'.$pag.'"></a>
<div class="pagecontent '.$pag.'">
    <h2>'.returnPageField($pag,'title').'</h2>
    '.returnPageContent($pag).'
</div>
';
}
(if you had customized the foreach, etc., you know what you have to change there.)

- If you were using the previously posted script in the template, remove it and put <?php get_page_content(); ?> instead.

If not, you don't need to touch your template. But you have to:

- Go to Admin > Settings and set your Custom Permalink Structure to:
Code:
#%slug%

(I've done just a quick test with this... backup before trying...)
Reply
#18
Anyway, there must be a better way to do this. Something that doesn't require that funny permalink structure and allows having both the one-page main site and also normal single pages.

I may give this a try some day (if no one else has yet ;-))
Reply
#19
i'm doing menu like:

PHP Code:
<?php
  
global $pagesArray;

  
?>
 
       
     <i>
     <ul id=""> 
     <?php 
    $numerglownegomenu 
1;
         
        
         foreach (
return_i18n_menu_data('krzysiek',1,1) as $menu) {
             
              
$m4 $menu['url'];
               
               
?>
                
             <li class="" id="">
             
 <a href="#<?php getPageField($m4,'title')?>"   title="<?php getPageField($m4,'title')?>"><?php getPageField($m4,'title')?></a>
 </li>
 <?php      $numerglownegomenu++;    ?>
<?php 
?>
</ul>
</i> 
user plugin: scroll to top
Reply
#20
(2014-04-04, 15:54:05)Carlos Wrote: Anyway, there must be a better way to do this. Something that doesn't require that funny permalink structure and allows having both the one-page main site and also normal single pages.

I may give this a try some day (if no one else has yet ;-))

Or allows different page templates to be used, eg full-width, two column, three column, with & without Title, and pages included in the single page but not in the menu maybe.

It works well atm but I need to disable the CKEditor to make anything other than a simple page layout. But thanks Carlos.
Reply
#21
I love the Carlos script http://get-simple.info/forums/showthread...4#pid23834 it works great for a site that has all pages in the index page. But now I'm wondering if there's any way to have a site with just the sub pages in a mater page (like a single page site) and the rest of the site as normal. That way it would be nice to have several pages with the sub pages included like in a single page scrolling site. Any thoughts?
Reply
#22
How you make big complex pages and how you navigate them is er, a big complex question. This thread
http://get-simple.info/forums/showthread.php?tid=5603
was a brief discussion in which Shawn gave me some php to put sub pages into parent pages like what you describe, but without the anchors. It worked iirc but I decided the simplest way to get what I wanted was to make modular partial template files so I could easily make a custom page template with any combination of rows of columns and content blocks.
Reply
#23
This is why drupal has "blocks" and why our cms is called getsimple.
Smile

block layouts can get very complicated.
I think the easiest thing would be for a pages to dynamically load a bunch of text inputs for all its blocks ( in-stead of the 1 content block we have in core ) when a template is loaded that defines blocks. And it could even show a block layout selection.

Templates could be written to use their own pages, or components or file storage as they see fit. But the problem here becomes the decoupling of theme functionality and plugin functionality. A theme alone cannot do this stuff currently.

Now I have asked for input in the develop forum for input that themers might need for this kind of support.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#24
(2014-11-09, 22:39:32)davetest Wrote: I love the Carlos script http://get-simple.info/forums/showthread...4#pid23834 it works great for a site that has all pages in the index page. But now I'm wondering if there's any way to have a site with just the sub pages in a mater page (like a single page site) and the rest of the site as normal. That way it would be nice to have several pages with the sub pages included like in a single page scrolling site. Any thoughts?

Thanks Timbow and shaun_a for responses. Shaun I'm right with you and so happy not to be using Drupal - GS for me every time!

I've managed a temporary fix using Simple Input Tabs plugin and placing each of the 'pages' of my single page sections into separate tabs using a page template that uses the Simple Input Tabs <?php insert_page_content(); ?> tag and the 'conventional' GS pages with a different page template. It works ok and I'm using a component to manually make a menu for reaching the anchors in the single page sub pages. Maybe if I was smarter I could work out how to use sub-menus form the I18n plugin for my single page pages.
Reply
#25
This is my variation of the Carlos script, tweaked to outputs only pages that are children of the current page and non-private. So pages can be automatically built from it's child-pages. Works fine for me, I use menu order for sorting and once the order is OK turn off "show in menu" to hide those pages from the nav menu.

PHP Code:
<?php
    
global $pagesArray
    
$pagesSorted subval_sort($pagesArray,'menuOrder'); // or 'title', 'menu', 'url', ...
    
$thisPage return_page_slug(); 
    
    foreach (
$pagesSorted as $page) if ($page['parent']==$thisPage && $page['private']!='Y') {
        
$pag $page['url']; ?>
        <article class="subpage">
        <a id="<?php echo $pag?>"></a>
            <h2><?php getPageField($pag,'title'); ?></h2>
        <div class="subcontent">
            <?php getPageContent($pag); ?>
        </div>
    </article>
        <?php ?>

I assume that the global "pagesarray" is the GS cache?
I wonder if it is possible to use GetChildern or GetChildrenMulti to do the same.
If so, which is more efficent for the server, or does it all happen via the cache anyway?

I have been using GS for a couple of years now, and I should say, it's the first CMS I actually enjoy theme-ing/templating.
Reply




Users browsing this thread: 1 Guest(s)
Free HDTV Channels Residential Solar Panels