Include components inside page - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: Include components inside page (/showthread.php?tid=2177) |
Include components inside page - amaurib - 2011-09-12 Hello I have 2 components that i want to include on different pages. how can i do that without creating a new template for that page? thanks a lot. Include components inside page - mvlcek - 2011-09-12 amaurib Wrote:Hello Install the DynPages plugin and include the following on the page: Code: {% my-component-name %} Include components inside page - DonR - 2011-09-13 This is what I'm using to manage and reuse components to be displayed outside the "page" wysiwyg editor. Sometimes some difference in the header, sidebar or other static area of the page is useful. The i18n component is installed. For the sidebar it could be coded like this: Code: <div id="sidebar"> There is flexibility and simplicity ( thanks to GetSimple! ) and typing the php code for your needs is simple too. Your code needs to between "<?php" and "?>". In the above code the sidebar-custom-1 component is used in the index and contact pages. And the sidebar-custom-2 component is used in the testimonials page. And if there is a component with the same name as the active page, it will display automatically via the code: Code: get_i18n_component((string) return_page_slug()); and, if none of the above criteria is met, then nothing is added to the sidebar. I'm new to GetSimple, so please let me know if this flexibility is already handled elsewhere. I didn't find much about making custom code for individual pages and pieced this code from the excellent documentation for the i18n and other plugins. Thank you. Include components inside page - mvlcek - 2011-09-13 DonR Wrote:This is what I'm using to manage and reuse components to be displayed outside the "page" wysiwyg editor. Sometimes some difference in the header, sidebar or other static area of the page is useful. This is exactly the easiest way to have custom sidebars. You could of cause also test e.g. for the parent of a page like Code: if (return_parent() == "products") get_i18n_component('sidebar-products'); There is another possibility, if you have only a few custom sidebar components, but lots of pages and want to assign components to pages. You can use the I18N Custom Fields plugin and configure it to have a dropdown field (named e.g. 'sidebar-component') with all possible component names. Then this dropdown field will be shown on every page edit view and you can choose a component to display in the sidebar. In the template you would just include Code: get_i18n_component(get_custom_field('sidebar-component', 'name-of-default-component')); |