Mailing List Archive

[Bricolage-General] Making all articles in a category use the same structure
Hi all, we're having an issue with which is the best way to manage the
structure of an article
from within Bricolage, where the page structure ( in the lame ascii
graph is 2), and
the article text (2), are separated, being the structure generic to a
whole bunch of
articles.


|--------------|
| 2 |
| |--------| |
| | | |
| 2| 1 | 2|
| | | |
| | | |
| |--------| |
| 2 |
|--------------|



Currently, like it's documented in Bric::ElementAdmin, a Story can
include several sub-elements
that can be used to manage the navigation columns, header and footer.

One can also manage this elements in a "Structure Article" that can be
added
as "Related Story" and used in that article - also documented in
Bric::ElementAdmin ("Establishing Relationships").

However, we'd like that the editorial interface would be quite limited
when inserting
an Article, mostly to reduce the number of steps needed to publish a
Story, since
Relating needs to add a related story, find and relate it.

There's a different approach to this issue, that i'd like to discuss.
Basically, the site manager uses a different Output Channel to create
the "Structure Article", or the page without the main article, that
will be included as a template. The story needs to be burned before
being used from the "Article story", we're using a local destination to
publish the output channel associated with this story type.

To better understand this idea, please follow the step-by-step.
Please note that i'm not very familiar with some Mason techniques that
would probably make this easier. But this example is generic enough to
work with another burners. It assumes that HTML::Mason is used as the
burner though.

- Add a new Output Channel named "Article Structures",
with "Use Slug for Filename" checked,
file Extension "mc". It's probably better to remove the
"/year/month/day/slug"
portion of the URI format, if the element type used to create the
structure doesn't
have the "Fixed" flag on.

- Add a new Destination with "Filesystem" selected in "Move Method" and
add to
"Current Output Channels" the "Article Structures" Output Channel
previously created.

- Add "move" action and a new Server, where the "Document Root" is
located in someplace
where the Templates can find them.

- Add a new Element named "Article Structure",
with type "Covers". Add the Output Channel "Article Structures" to the
"Current Output Channels" list.


- In this element add elements that are used in the Article Structure,
from "Column" type
or whatever you need.

- Add a new Template for the "Article Structure" Element. Select
"Article Structures" as
the Output Channel. Select the Category where the articles that will
use this structure
will be located.

- Create the template code, calling all the sub-elements in the ordinary
Bricolage fasion
as specified in the Bric::Templates manpage.

- Now, in the template code, in the place where the article asset must
appear place:

"<%text><% $ARGS{article} %></%text>"

- Save and Deploy the template.

- Create a story with "Article Structure" as Story Type. Select the same
category
used in the Template creation and use "structure" as the slug.
Create the Article structure in the way suggested in
Bric::ElementAdmin.

- Now save and Publish the Story. If everything's ok, you'll have in
DESTINATION_DIR/CATEGORY/structure.mc your story burned with
"<% $ARGS{article} %>" ready to accept some code.

- Edit the Story Template in a way that all the output is sent to a
variable called
$article.

- Call at the end of the template the structure.mc component created
through Bricolage:

%my $s_path = "/DESTINATION_DIR".
$story->get_primary_category->get_uri . "/structure.mc";
<& $s_path, article => $article &>


- Save and Deploy the Template.

- Create a regular Story in the category used before.


If you preview it, the story should appear wrapped by the "Story
structure" created before.
This gains efficiency since the story structure is only created once,
although
some parts of it can be loaded dinamically using the "<%text></%text>"
trick.


The biggest drawback in this: I had to hack Bric::Util::Burner::Mason to
include
the DESTINATION_DIR in the comp_root.

There's probably a more elegant way to do it, i haven't looked
in depth to the new features in 1.4.5, so i'd like some feedback
on the best way to do this.


Thank you for your time,
Joao Pedro









--

João Pedro Gonçalves
http://www.sapo.pt/ - Portugal Online



-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing
your web site with SSL, click here to get a FREE TRIAL of a Thawte
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Bricolage-General mailing list
Bricolage-General@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bricolage-general