Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding multiple get_component( );
#1
Hello everyone,

I was looking for a databaseless CMS solution and I found GetSimple and fell in love Wink

I am working normally with Joomla and Wordpress so it looked quite familiar and I created a theme quite quickly.

But now I am a bit lost and I couldn't find a solution for my problem after searching the internet by Google all night and I didn't find the right apporach here either.

In Joomla and Wordpress I am used to add positions for modules (Joomla) and widgets (Wordpress). If I did understand it correctly this feature is called "components" in GetSimple.

So when I had a look at the standard theme I saw two tags
Code:
"get_component('sidebar');
and
Code:
<?php get_component('tagline'); ?>

Now I would like to add extra "sidebars" over and under the container with the main content.

Like I said before I did a thorough research and I wanted to know if these extra "sidebars" should be created in the functions.php like the sidebars in Wordpress.

I tried to insert component tags directly in the template.php (for learning reasons I don't have include files)

I created three div's (each 31% with 2% margin right except for the one at the right side) and inserted
Code:
"get_component();"
-tags

Code:
<div class="col_100 wrap">
        <div class="col_33">
        <?php get_component('left'); ?>
        </div>
        <div class="col_33">
        <?php get_component('center'); ?>
        </div>
        <div class="col_33 wrap">
        <?php get_component('right'); ?>
        </div>
</div>

In the backend of GetSimple there are no buttons added (the ones one sees at the right when managing/creating components). After adding these tags there are still just two buttons.

One called "sidebar" and one called "tagline".

I addded an image to visualize the buttons I am wrting about.

My clients really like to have many positions in their design (even if they mostly don't use them but they pay and I play Wink ) and I would love to offer this CMS as a new service for clients who have a hosting package without a database. Saves me endless discussions why they need to upgrade and pay more, which is always an unpopular issue Smile

Thanks in advance for any help!

Regards,

Rob van Linda


Attached Files Thumbnail(s)
   
Reply
#2
Did you read the page in the wiki about components?
http://get-simple.info/wiki/components

You have to create the components and then add the component code in your template. For what I know the functions.php file is not for that.
See: http://get-simple.info/wiki/theme:advanced

The buttons you rever to are just links to the components. If you have like a list of 8 or more components, they are easier to find.

What might also be interesting is getPageContent(), details over here: http://get-simple.info/wiki/themes:template_tags (second).

This way you can make content boxes from pages and so make it easier for clients to edit the content.
Reply
#3
Hello datiswous,

first thank you for your quick reply and your help

So I could predefine compoennts and leave them empty (I have read somewhere that components can be empty)?

As far as I understood the
Code:
getPageContent()
can be used only once?

Best regards,

Rob
Reply
#4
Welcome to the GS forum Rob.

I se datiswous has already answered.

I was doing this yesterday:
http://get-simple.info/forums/showthread...2#pid43032

You can have an empty component and you can have a component in a component.
Reply
#5
(2014-02-13, 20:51:27)cyberviews Wrote: Hello datiswous,

first thank you for your quick reply and your help

So I could predefine compoennts and leave them empty (I have read somewhere that components can be empty)?

As far as I understood the
Code:
getPageContent()
can be used only once?

Best regards,

Rob
There's
Code:
<?php get_page_content(); ?>
Which gives the content of that specific page.
Then there's
Code:
<?php getPageContent('slug'); ?>
, which is for showing the content of a specific page in every page (with that template active). If you want different content boxes on different pages, you can use different template files for pages.
See also: http://get-simple.info/wiki/components-d...n-the_page (don't know if something like that is possible with pages as well).

Timbow Wrote:..and you can have a component in a component
Why wohould someone want to have a component in a component?
Reply
#6
(2014-02-13, 20:57:59)Timbow Wrote: Welcome to the GS forum Rob.

I se datiswous has already answered.

I was doing this yesterday:
http://get-simple.info/forums/showthread...2#pid43032

You can have an empty component and you can have a component in a component.

Hello Timbow,

also thanks to you for replying to my question and for helping.

So I added the tag
Code:
<?php getPageContent('right-column'); ?>
in my template.php and went to the "pages" area in the backend.

On your screenshot there were options added but in my backend there were none.

Please forgive me when I'm asking stupid questions, but I started with this cms two days ago and I didn't find a solution for clients to "just" write a text nad/or add images and to give them the choice to add it on a template position.

I have read that there is a request for adding the editor to the area where components are created or modified. Are there serious plans for doing so?

Best regards,

Rob van Linda
Reply
#7
(2014-02-13, 22:01:14)cyberviews Wrote: So I added the tag
Code:
<?php getPageContent('right-column'); ?>
in my template.php and went to the "pages" area in the backend.

On your screenshot there were options added but in my backend there were none.

You need to create a page with the 'slug' right-column and insert the content of the page into your template with the tag
<?php getPageContent('right-column'); ?>

The page is not automatically created when you use the tag. If you make the page right-column the child of the main page it is tidier in the admin display.

Ask anything, anytime, you are welcome.

I belive GSv4 is to have an improved system for secondary content blocks, 'snippets'?
Reply
#8
(2014-02-13, 21:44:45)datiswous Wrote: Why wohould someone want to have a component in a component?

Any reason you like. Put the tagline in the sidebar for instance. In the real world I think the last time I did so I had a separate component for a list of links which could be inserted in the left or right sidebar or the main content as required, or sometimes I have called a contact form in a component so I can put it in a page or in a sidebar in different parts of the site.
Reply
#9
(2014-02-13, 22:21:25)Timbow Wrote:
(2014-02-13, 22:01:14)cyberviews Wrote: So I added the tag
Code:
<?php getPageContent('right-column'); ?>
in my template.php and went to the "pages" area in the backend.

On your screenshot there were options added but in my backend there were none.

You need to create a page with the 'slug' right-column and insert the content of the page into your template with the tag
<?php getPageContent('right-column'); ?>

The page is not automatically created when you use the tag. If you make the page right-column the child of the main page it is tidier in the admin display.

Ask anything, anytime, you are welcome.

I belive GSv4 is to have an improved system for secondary content blocks, 'snippets'?

You are very kind helping me so much Smile

Now this is a nice option and it works perfectly.

But each slug can only be used once, because I am sure that the system will use it to save each article as a unique item and creates the url out if it.

So I might consider teaching my clients to create a page, copy the sourcecode and to add it into a component.

After all is this system way more easy than large CMS and they will manage it.

Thanks again and regards,

Rob van Linda
Reply
#10
I wouldn't see the need to copy and paste. You are right that in GS the page content is written in an xml file and the 'slug' is the filename of that file. It is also the last part of the url if you are using seo friendly 'fancy urls'. Components are not stored as individual files in quite the same way.
Reply
#11
(2014-02-13, 22:49:25)Timbow Wrote: I wouldn't see the need to copy and paste. You are right that in GS the page content is written in an xml file and the 'slug' is the filename of that file. It is also the last part of the url if you are using seo friendly 'fancy urls'. Components are not stored as individual files in quite the same way.

I tried to give one slug to two pages and the system automatically added an appendix to the slug.

I used your example "right-column" and added this in the template <?php getPageContent('right-column'); ?> .

I created a text page with this slug and it appeared in the right sidebar.

I created a second page and added the same slug (right-column) in the options.

After saving there was "right-column-1" in the slug field and this page didn't appear in the sidebar.
Reply
#12
(2014-02-13, 22:36:53)cyberviews Wrote: But each slug can only be used once, because I am sure that the system will use it to save each article as a unique item and creates the url out if it.
How whould that be a limitation?
Reply
#13
(2014-02-13, 22:57:24)datiswous Wrote:
(2014-02-13, 22:36:53)cyberviews Wrote: But each slug can only be used once, because I am sure that the system will use it to save each article as a unique item and creates the url out if it.
How whould that be a limitation?

Well the tag in the template <?php getPageContent('right-column'); ?> calls the page with that specific slug (right-column).

So if the sytstem adds an appendix automatically to a slug that is used twice, the tag in the template wont find that one.
Reply
#14
I use components when I need it for only a few things or need to use code.

like
get_component('sidebar_'.$slug);
so each page can have a unique sidebar.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#15
(2014-02-13, 23:57:41)shawn_a Wrote: I use components when I need it for only a few things or need to use code.

like
get_component('sidebar_'.$slug);
so each page can have a unique sidebar.

That's a great option.

But my clients are no experts and this would just confuse them.

Clients need is as simple as possible for they have their business and little time to spend on their website Smile
Reply




Users browsing this thread: 1 Guest(s)