doc/book/en/devweb/views/xmlrss.rst
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 28 Jun 2011 17:59:31 +0200
changeset 7570 648bf83945a5
parent 5394 105011657405
child 8032 bcb87336c7d2
permissions -rw-r--r--
[etwist] log missing file even in debug mode
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2544
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
     1
.. _XmlAndRss:
282261b26774 [doc] fixed some dangling internal links
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
     2
5312
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     3
XML and RSS views
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     4
-----------------
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     5
d2dbba898a96 [doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 5266
diff changeset
     6
(:mod:`cubicweb.web.views.xmlrss`)
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     7
4744
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
     8
Overview
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
     9
+++++++++
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    10
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    11
*rss*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    12
    Creates a RSS/XML view and call the view `rssitem` for each entity of
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    13
    the result set.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    14
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    15
*rssitem*
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    16
    Create a RSS/XML view for each entity based on the results of the dublin core
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
    17
    methods of the entity (`dc_*`)
4744
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    18
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    19
RSS Channel Example
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    20
++++++++++++++++++++
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    21
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    22
Assuming you have several blog entries, click on the title of the
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    23
search box in the left column. A larger search box should appear. Enter::
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    24
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    25
   Any X ORDERBY D WHERE X is BlogEntry, X creation_date D
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    26
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    27
and you get a list of blog entries.
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    28
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    29
Click on your login at the top right corner. Chose "user preferences",
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    30
then "boxes", then "possible views box" and check "visible = yes"
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    31
before validating your changes.
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    32
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    33
Enter the same query in the search box and you will see the same list,
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    34
plus a box titled "possible views" in the left column. Click on
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    35
"entityview", then "RSS".
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    36
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    37
You just applied the "RSS" view to the RQL selection you requested.
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    38
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    39
That's it, you have a RSS channel for your blog.
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    40
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    41
Try again with::
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    42
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    43
    Any X ORDERBY D WHERE X is BlogEntry, X creation_date D,
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    44
    X entry_of B, B title "MyLife"
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    45
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    46
Another RSS channel, but a bit more focused.
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    47
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    48
A last one for the road::
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    49
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    50
    Any C ORDERBY D WHERE C is Comment, C creation_date D LIMIT 15
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    51
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    52
displayed with the RSS view, that's a channel for the last fifteen
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    53
comments posted.
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    54
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    55
[WRITE ME]
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    56
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    57
* show that the RSS view can be used to display an ordered selection
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    58
  of blog entries, thus providing a RSS channel
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    59
0772d4e29d52 [book] cleanup (deleting/moving) old stuff
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 2544
diff changeset
    60
* show that a different selection (by category) means a different channel