Share » Forums » Setup & design » Blog snippet on homepage

Blog snippet on homepage

Blog snippet on homepage

Wednesday 16 April 2008 2:38:51 pm - 10 replies

Modified on Monday 12 May 2008 5:10:28 pm by Brian Henkel

Author Message

Maxime Thomas

Wednesday 16 April 2008 11:33:55 pm

Hi,

I think you can :
- look at the template called in the homepage
- make an override for this one
- use one this operators (shorten or extract_left):

http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_operators/strings

Hope it helps.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Peter Putzer

Thursday 17 April 2008 2:03:57 am

Better yet, use the "teaser" operator provided by the xmlwash package, availabel at http://projects.ez.no/xmlwash. It can be seen in action on http://pluspunkt.at (the thumbnail images are also automatically extracted from the blog posts!).

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

Maxime Thomas

Thursday 17 April 2008 10:50:11 pm

Or you can try to make a new view. It's more in the ez way, I guess :-D

http://ez.no/doc/ez_publish/technical_manual/4_0/reference/template_override_conditions

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Brian Henkel

Monday 12 May 2008 6:03:27 pm

I created an override for my frontpage.tpl file. So how do I use an operator to only display a small portion of the blog post? I'm assuming I have to put something here (in frontpage.tpl) where the blog post is being displayed.

<div class="right-column-position">
            <div class="right-column">
            <!-- Content: START -->
                  {attribute_view_gui attribute=$node.object.data_map.right_column}
            <!-- Content: END -->
            </div>
        </div>

THANKS!

Maxime Thomas

Monday 12 May 2008 10:31:05 pm

You must replace the attribute_view_gui line by something like :

{$node.object.data_map.right_column.content|wash()|extract_left(50)}

Where 50 is the number of chars you would like to keep.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Brian Henkel

Tuesday 13 May 2008 10:08:58 am

Hmmm, doesn't work for me. Replacing with the following just removed all content from that column:

<div class="right-column-position">
            <div class="right-column">
            <!-- Content: START -->
                    {$node.object.data_map.right_column.content|wash()|extract_left(50)}
            <!-- Content: END -->
            </div>
        </div>

I don't consider myself an administrator or coder, so I'm sure I'm just missing something. However, I do appreciate your help, Maxime!

Maxime Thomas

Wednesday 14 May 2008 12:04:20 am

Ah, ok.
It may be hard so.

What datatype (Textline, Text block, Image, XML block,...) is used for the attribute right_column ? If you don't know where to find this information, you can look at Setup > Classes > Content > <Name of the content class> > <Attribute with the identifier right_column>

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Brian Henkel

Wednesday 14 May 2008 7:33:54 am

I appreciate this, Maxime.

It says:
"5. Right column [XML block] (id:239)
Name:Right column
Identifier:right_column
Flags:Is not required
Is searchable
Does not collect information
Translation is enabled
Preferred number of rows: 20"

Here is a snapshot of this in my admin:
http://bhenkel.echoechoplus.com/rightcolumn.jpg

Maxime Thomas

Wednesday 14 May 2008 10:50:15 pm

Now you know that is a XML Block, you can try to show what inside the content attribute object. When you manipulate :

$node.object.data_map.right_column

It refers to an attribute (regarding to the input form, it'sonly the part concerning the right column). Then, you can show what is inside this object using the attribute(show) function.

{$node.object.data_map.right_column.content|attribute(show)}

It will show a table with 3 columns : attribute, type, value. If nothing appears, there's two reasons : maybe what you have passed as value is not a table or maybe it's null.
For each attribute, you can acces its content by just adding ".content". As above.
If my memory is ok, you would have to add ".output" finally to get get only the XML. Then you must process it to extract only what you want (and escape the XML stuff).

{$node.object.data_map.right_column.content.output}
{$node.object.data_map.right_column.content.output|attribute(show)}

Good luck !

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Peter Putzer

Thursday 15 May 2008 2:31:30 am

Sorry if I wasn't too clear: Of course creating a custom view is needed for the blog snippets. However, the teaser operator lets you get a snippet out of an XMLText attribute.

Accessible website starting from eZ publish 3.0 (currently: 4.1.0): http://pluspunkt.at

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu