GetSimple Support Forum

Full Version: Use of Components
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I have a couple of questions..

Is it ok to call components <?php get_component('test'); ?> within the page content instead of template code? I have tested it and it works but is there anything I should know of.

I need to add unique component to every page. Is there any disadvantages in creating many components? Lets say 100+ pages with 100+ unique components?

Thanks in advance.
you would need the php-exec plugin to add php into the body of a page, but if you are doing that, then why create a component for this? Why not just put what would be in the component directly into the page?
I already installed php-exec which works fine but when I put my code, it just shows a blank page. This particular code also includes javascript within the php codes.
But when I put them in component it works!

I like the php-exec plugin which I also use in wordpress but here it doesn't work.

Thanks
mosa Wrote:I already installed php-exec which works fine but when I put my code, it just shows a blank page. This particular code also includes javascript within the php codes.
But when I put them in component it works!

I like the php-exec plugin which I also use in wordpress but here it doesn't work.

Thanks

Put the code into a component and use the DynPages plugin to include it in a page. You can also parametrize the component this way, see also here.
So I understand using DynPages I can include component {% component1 %} in a page.

Is there any limit how many component can be created? I will need a unique component for each page and that could be hundred over the time.
mosa Wrote:So I understand using DynPages I can include component {% component1 %} in a page.

Is there any limit how many component can be created? I will need a unique component for each page and that could be hundred over the time.

Why do you need a unique component for each page? What are you trying to accomplish? Can you give us examples?
Ok, say I have to create a page for red apples, after description there will be a price table from different retailers.
So this red apples page should show red color apples in default and the table has options to narrow it down by size, weight etc.
Now if I have to create green apples page and show green color apples in default result then I have to mention that in the code. And the list goes on.
mosa Wrote:Ok, say I have to create a page for red apples, after description there will be a price table from different retailers.
So this red apples page should show red color apples in default and the table has options to narrow it down by size, weight etc.
Now if I have to create green apples page and show green color apples in default result then I have to mention that in the code. And the list goes on.

This rather sounds like you need one component parametrized by product type or code, which then retrieves the price information from the retailers or a database.

Alternatively - if the information does not change often - you could put the table with the prices, sizes, etc. on the page itself and then use some jQuery magic to filter the table and hide non-matching rows.
Thanks, doing that is out of my comfort zone. I kind of thought it will work as I have php-exec and completed some design work.
I like this cms as it is very easy to maintain and lightweight but there you go.
mosa Wrote:Thanks, doing that is out of my comfort zone. I kind of thought it will work as I have php-exec and completed some design work.
I like this cms as it is very easy to maintain and lightweight but there you go.

So you are no programmer ;-)

Regarding the number of components it will probably work just find with 100 components, but I would never manually create that many, but instead write one component getting the data from somewhere based on the product (code or id). I'm a programmer and thus f**king lazy.
php-exec works if I remove the line below but then javascript side fails. Although the whole code works in wordpress with php-exec plugin.

Code:
echo  "<script type=\"text/JavaScript\">\n <!--\n var defaultOptions=\"$defaultOptions\";\n //-->\n </script>\n";