[opencms-dev] Trying to include a file and have template applied
Polizzi, Jim
Jim.Polizzi at bankofamerica.com
Tue Nov 11 00:06:01 CET 2003
Matt,
It's OBVIOUS that you've been down this road before. It's like you're reading my thoughts!
>The exception to this would be if you wanted to do many different
>formats for the SideArea file (e.g. 6 or 7 different complex table
>layouts depending on what info is inside the SideArea.html file).
Yes - the reason that I was wanting to have a template applied is because I want to have differant "formats" of SideArea - or BodyArea, etc. Possibly to allow with one "BodyArea" sub-template the ability to create a 2 column body - with a separate "page" for each column... The idea is to allow the content editor to be able to assemble various templates together and piece them together into a page. Possibly with the following structure (for some page of the site - but a completely differant structure for another page of the site):
Main Template and page
Two Part Body Area Template
Content 1
Content 2
Multi-Part Side Area
Nav Index
Feature 1
Feature 2
>In that case, you would have to basically create a recursive template
>parser/processor, as others have already suggested.
Has that been done? Does that capability exist? If so - where?
Also - Thanks for the tip on: "multiple content bodies option". I'll research it. This might be Exactly what I need for several things that I'm trying to do!
Jim
-----Original Message-----
From: M Butcher [mailto:mbutcher at grcomputing.net]
Sent: Monday, November 10, 2003 3:44 PM
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] Trying to include a file and have template
applied
Polizzi, Jim wrote:
>Wow!!!
>
>Thanks for taking so much time in answering my question...
>
>Actually - I was trying to simplify my question so that I could give a good code sample. In reality - I'm to create it so that my users (content editors) don't write ANY JSP's... but I left out some stuff in my original description.
>
>Here's what I'm really trying to do (with NO code samples).
>
>I want to have an overall Page level template (Page.jsp template) (which applies headers, footers, nav menus, etc.). Then, allow the user to specify whatever body content that they like.
>
>
This would be a regular template, right. I mean, this is what a template
usually does.
>Then, I'd also like my Page level template to look for (for example) a file in the same directory as the current page called "SideArea.html" (or whatever). If it finds it - it includes it - otherwise, it doesn't.
>
>
And again, this is pretty easy to do in the template. See if the file
exists. If yes, then include it.
>The SideArea.html file has a template defined for it (the SideArea.jsp template) which has a table setup to make a nice "feature box". The user enters their content into this SideArea.html file - and I want the SideArea.jsp template applied to it.
>
>
Now this is where I'm starting to get hazy. Why have a template defined
for what equates to a snippet of code? Wouldn't you just put the
"template" inside of the page template you spoke of above? I mean, if
it's just a table, it would be better and faster to just use the main
template to do the formatting.
The exception to this would be if you wanted to do many different
formats for the SideArea file (e.g. 6 or 7 different complex table
layouts depending on what info is inside the SideArea.html file). In
that case, you would have to basically create a recursive template
parser/processor, as others have already suggested.
>I can imagine several of these types of elements (SideArea / Feature Area / etc.)... that will be included in the page if they exist... the main point being that I want to provide Templates for each of these Page Sub-Elements - to simplify the work that the User (content editor) has to do to compose a rich page - that is consistant across the site.
>
>
I don't particularly see a problem with multiple additions. Your
template may get bigger, but that is still preferable to implementing
recursive template processing (for performance _and_ complexity reasons)
>In order to do this - I need a way to include a file from my Main Page Template (Page.jsp) - and the included file needs to have IT'S template applied.
>
>
Again, I think this solution is the more complex way of solving the problem.
In the past, I've done the type of include that I'm explaining as a way
of providing HTML ads, as well as dynamic or static content ("tip of the
day" or extra bits of text). It works fairly well, and isn't hard to do.
Others have done something slightly different: they have enabled the
multiple content bodies option and used the extra body fields to add the
additional text. For more on that, you may want to search through the
list archives or check out the forums.
Matt
_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list