Accessors (on newsItems)

6 Messages Forum Options Options
Permalink
nesapio
Accessors (on newsItems)
Reply Threaded More
Print post
Permalink
Hello,
I would like to write a listing for the news Items in my sitem but I don't know how to access the Text attribut of the newsItems. Is there a possibility to list all accessors of a content type, or is there a good documentation about these accessors and fields of certain types? I already tried this:


               

tal:replace="obj/getText" tal:replace="obj/Text"
but none of these works.

Furthermore I would like to have the newsItems in an archiv. The archiv should have a lot of pages and on every page there should only be 10 items, then the next 10 and so on. I would like to make a Linklist, where I can navigate to the 20th or 30th NewsItem page. I tried to generate the HTML explicitly with an python script, but that doesn't work, because the html is inserted without being interpreted. Is there a better solution to make such a Linklist?

Pleas help me, especially with the accessor, it's so frustrating to know the information is stored in the newsItem, but not being able to access it.

Sören
eleddy
Re: Accessors (on newsItems)
Reply Threaded More
Print post
Permalink
to get an attribute, you use the get<attrName> concept, with the first
letter of the attribute name being uppercase.  But Text might not be
the name of the attribute :) You can look at the schema to double
check.  also make sure that obj is actually an object and not a
catalog result.

not sure that I 100% get your second question, but it seems like what
you are looking for is the tal "structure" syntax.

hth,

eleddy

On Jul 24, 3:57 am, nesapio <calimer...@...> wrote:

> Hello,
> I would like to write a listing for the news Items in my sitem but I don't
> know how to access the Text attribut of the newsItems. Is there a
> possibility to list all accessors of a content type, or is there a good
> documentation about these accessors and fields of certain types? I already
> tried this:
>
> tal:replace="obj/getText" tal:replace="obj/Text"
> but none of these works.
>
> Furthermore I would like to have the newsItems in an archiv. The archiv
> should have a lot of pages and on every page there should only be 10 items,
> then the next 10 and so on. I would like to make a Linklist, where I can
> navigate to the 20th or 30th NewsItem page. I tried to generate the HTML
> explicitly with an python script, but that doesn't work, because the html is
> inserted without being interpreted. Is there a better solution to make such
> a Linklist?
>
> Pleas help me, especially with the accessor, it's so frustrating to know the
> information is stored in the newsItem, but not being able to access it.
>
> Sören
> --
> View this message in context:http://n2.nabble.com/Accessors-%28on-newsItems%29-tp580099p580099.html
> Sent from the General Questions mailing list archive at Nabble.com.
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the worldhttp://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Plone-Users mailing list
> Plone-Us...@...://lists.sourceforge.net/lists/listinfo/plone-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Israel Saeta Pérez
Re: Accessors (on newsItems)
Reply Threaded More
Print post
Permalink
Hello nesapio,

On Thu, Jul 24, 2008 at 12:57 PM, nesapio <calimero.2@...> wrote:

>
> Hello,
> I would like to write a listing for the news Items in my sitem but I don't
> know how to access the Text attribut of the newsItems. Is there a
> possibility to list all accessors of a content type, or is there a good
> documentation about these accessors and fields of certain types? I already
> tried this:
>
>
>
> tal:replace="obj/getText" tal:replace="obj/Text"
> but none of these works.

According to:

#CMFPlone/skins/plone_content/newsitem_view.pt
    <tal:main-macro metal:define-macro="main"
          tal:define="...
                      text python:here.CookedBody(stx_level=2);
                      ...">
[...]
        <div metal:define-macro="text-field-view"
             id="parent-fieldname-text" class="stx"
             tal:define="...
                         text text|here/getText|nothing;
                         ...">

either python: here.CookedBody(parameters) or here/getText should work.

> Furthermore I would like to have the newsItems in an archiv. The archiv
> should have a lot of pages and on every page there should only be 10 items,
> then the next 10 and so on. I would like to make a Linklist, where I can
> navigate to the 20th or 30th NewsItem page. I tried to generate the HTML
> explicitly with an python script, but that doesn't work, because the html is
> inserted without being interpreted. Is there a better solution to make such
> a Linklist?

See http://plone.org/documentation/tutorial/plonebatch/ ;-)



--
Israel Saeta Pérez
http://dukebody.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Israel Saeta Pérez
nesapio
Re: Accessors (on newsItems)
Reply Threaded More
Print post
Permalink
Hi,
eleddy, whats the difference whether it's an Object or a catalog result?
This is how the results are generated:

tal:define="view context/@@news_view;
                 start request/start|python:0;
                 results python:view.published_news_items()[int(start):10];
                 news_link view/all_news_link"
tal:condition="python:test(template.getId()!='news' and results, 1, 0)"

is there a better solution? is the body not part of the delivered objects?

This is how the objects should be used.
               
                Plone 2.1 announced!
               

               
                Plone 2.1 announced!
               

               

Thanks for the help so far.
Sören


eleddy wrote:
to get an attribute, you use the get<attrName> concept, with the first
letter of the attribute name being uppercase.  But Text might not be
the name of the attribute :) You can look at the schema to double
check.  also make sure that obj is actually an object and not a
catalog result.

not sure that I 100% get your second question, but it seems like what
you are looking for is the tal "structure" syntax.

hth,

eleddy

On Jul 24, 3:57 am, nesapio <calimer...@gmx.de> wrote:
> Hello,
> I would like to write a listing for the news Items in my sitem but I don't
> know how to access the Text attribut of the newsItems. Is there a
> possibility to list all accessors of a content type, or is there a good
> documentation about these accessors and fields of certain types? I already
> tried this:
>
> tal:replace="obj/getText" tal:replace="obj/Text"
> but none of these works.
>
> Furthermore I would like to have the newsItems in an archiv. The archiv
> should have a lot of pages and on every page there should only be 10 items,
> then the next 10 and so on. I would like to make a Linklist, where I can
> navigate to the 20th or 30th NewsItem page. I tried to generate the HTML
> explicitly with an python script, but that doesn't work, because the html is
> inserted without being interpreted. Is there a better solution to make such
> a Linklist?
>
> Pleas help me, especially with the accessor, it's so frustrating to know the
> information is stored in the newsItem, but not being able to access it.
>
> Sören
> --
> View this message in context:http://n2.nabble.com/Accessors-%28on-newsItems%29-tp580099p580099.html
> Sent from the General Questions mailing list archive at Nabble.com.
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the worldhttp://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Plone-Users mailing list
> Plone-Us...@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/plone-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users
Israel Saeta Pérez
Re: Accessors (on newsItems)
Reply Threaded More
Print post
Permalink
Hello nesapio,

On Fri, Jul 25, 2008 at 11:43 AM, nesapio <calimero.2@...> wrote:

>
> Hi,
> eleddy, whats the difference whether it's an Object or a catalog result?
> This is how the results are generated:
>
> tal:define="view context/@@news_view;
>                 start request/start|python:0;
>                 results python:view.published_news_items()[int(start):10];
>                 news_link view/all_news_link"
> tal:condition="python:test(template.getId()!='news' and results, 1, 0)"

When you search using the portal_catalog tool, it returns a lazy list
of items called brains. Lazy means here that the objects referenced in
that list are not waken up. Each brain has a series of attributes
consisting of values from the metadata table of portal_catalog you can
use in your listing templates without retrieving the objects.

In this case, results come from the published_news_items() method of
the Products.CMFPlone.browser.portlets.news.NewsPortlet class, which
turns out to return catalog brains.

> is there a better solution? is the body not part of the delivered objects?
>
> This is how the objects should be used.
>
>                Plone 2.1 announced!
>
>
>                Plone 2.1 announced!

The view @@news_view is deprecated. I don't know what _should_ be used
instead, but I would use the portal_catalog tool directly.

--
Israel Saeta Pérez
http://dukebody.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Israel Saeta Pérez
nesapio
Re: Accessors (on newsItems)
Reply Threaded More
Print post
Permalink
Thanks a lot, learned something new.

I know use the portal catalog and invoke the objects.

Israel Saeta Pérez wrote:
Hello nesapio,

On Fri, Jul 25, 2008 at 11:43 AM, nesapio <calimero.2@gmx.de> wrote:
>
> Hi,
> eleddy, whats the difference whether it's an Object or a catalog result?
> This is how the results are generated:
>
> tal:define="view context/@@news_view;
>                 start request/start|python:0;
>                 results python:view.published_news_items()[int(start):10];
>                 news_link view/all_news_link"
> tal:condition="python:test(template.getId()!='news' and results, 1, 0)"

When you search using the portal_catalog tool, it returns a lazy list
of items called brains. Lazy means here that the objects referenced in
that list are not waken up. Each brain has a series of attributes
consisting of values from the metadata table of portal_catalog you can
use in your listing templates without retrieving the objects.

In this case, results come from the published_news_items() method of
the Products.CMFPlone.browser.portlets.news.NewsPortlet class, which
turns out to return catalog brains.

> is there a better solution? is the body not part of the delivered objects?
>
> This is how the objects should be used.
>
>                Plone 2.1 announced!
>
>
>                Plone 2.1 announced!

The view @@news_view is deprecated. I don't know what _should_ be used
instead, but I would use the portal_catalog tool directly.

--
Israel Saeta Pérez
http://dukebody.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users