Welcome Guest, Not a member yet? Register   Sign In
CI template- Any Way to add the Template regions only once?
#1

[eluser]Unknown[/eluser]
I would like to know if there is any way to include only Content region in a page?
I am using the template library.
i have set the template, the header, footer, navigation menu,js, css are fixed for every page.
i don't want to load them for each page request.
I want to replace only content part, for the new request,

Is there any way to achieve this using template library?
any other way to implement same?

Thanks in advance
#2

[eluser]tomgkelly[/eluser]
In your template file where you use the following to render stuff in a region:
Code:
<?php echo $content> // or $nav or $whatever
This will cause an error if
Code:
$content
doesn't exist

Try:
Code:
<?php echo $content ? $content : '' ?>

This is the equivalent of:
Code:
if ($content)
{ echo $content; }
else
{ echo ''; }

I'm assuming your using the Williams Concepts Template Library, If not then I'd need to know which template library your using.

The above example allows you to use the same template even if you don't want to define data for some or all of the other regions.

I think I know what you trying to accomplish, but if not maybe you can clarify.




Theme © iAndrew 2016 - Forum software by © MyBB