Message from discussion
How admin section, templates and modules works together questions.
Date: Fri, 31 Aug 2012 12:40:48 -0700 (PDT)
From: Amiramix <li...@gjunka.com>
To: zotonic-users@googlegroups.com
Message-Id: <7e4c83c7-644e-4a2f-bbd6-b0c94176ac8a@googlegroups.com>
In-Reply-To: <CABCxKresbSryh-mEDXJOqp1aFcjHzaLh9r2OQES_E6sUsgvL4g@mail.gmail.com>
References: <4a9a6b09-b010-457c-8522-6394775ab447@googlegroups.com>
<CABCxKresbSryh-mEDXJOqp1aFcjHzaLh9r2OQES_E6sUsgvL4g@mail.gmail.com>
Subject: Re: [Zotonic-Usr] How admin section, templates and modules works
together questions.
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1637_14068321.1346442048860"
------=_Part_1637_14068321.1346442048860
Content-Type: multipart/alternative;
boundary="----=_Part_1638_21757991.1346442048860"
------=_Part_1638_21757991.1346442048860
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Andreas, many thanks for your answers. Yes, we are looking at the system
from different perspectives so I would love to clarify if I understood your
point properly. For the sake of an example say that the page looks like
this:
section header-copy-1 (some header + some copy)
A dynamic table
section header-copy-2 (another header + another copy)
A dynamic graph
I would like to generate the table and the graph using custom modules (say
the data is coming from an external server which I need to consume and
process).
According to your description I can create two page resources for section
header-copy-1 and header-copy-2 using the web GUI and then one template to
layout both sections, the table and the graph on a web page presented to
the user. If I edit either page resource (header-copy-1 or header-copy-2)
then the web page will be updated automatically when the template pulls
them from the database next time the web page is requested. Is my thinking
correct?
If yes, then is there any easy way of referencing a particular page
resource created using the web GUI in a template? I understand I could use
m.rsc[id] but the id is not shown by the web GUI (there is an integer in
the url and a unique name assigned in the GUI but I am not sure if either
can be reliably used to reference a page resource).
On Friday, August 31, 2012 7:56:11 PM UTC+1, Andreas Stenius wrote:
>
> templates is quite different from resources (pages).
>
> A resource holds data, but no presentation. The template is used to
> layout and present the resource data.
> Somewhat like html vs. css for separating the data from the
> presentation (design).
>
> > 1. If I create this page as a template, can I edit the template using
> the
> > editor from the admin section e.g. to correct any typos or the whole
> copy or
> > header without opening the template file?
>
> There is currently no way to edit the templates via the web GUI. The
> idea is that the templates are rarely changed,
> after they've been developed; but resources are created and edited
> continuously.
>
> > 2. Can I create the page using the HTML editor from the admin section
> and
> > somehow include the call to the module to include the dynamic table?
>
> I would have the design in a template, and get the data from pages. So
> you create the content in the admin.
> No need to call a custom module.
>
> > 3. Say I would like to have a few configuration options for generating
> the
> > table (e.g. number of rows for the sake of an example). Can I somehow
> > include such configuration option in the admin section of the site once
> the
> > module to generate the table has been enabled?
>
> There's a config model you can use from your template if you need
> configuration per site: http://zotonic.com/documentation/719/m-config
>
> > 4. Sometimes a page is build using only a template, but I can still edit
> the
> > page in the admin section (e.g. the homepage of the blog exemplary
> site).
> > The HTML editor doesn't show any text, it's empty. What is the purpose
> of
> > showing that editor for a page that is shown only from a template?
> >
>
> It depends on the what the template does with the content of the page.
> In the case above,
> maybe the content isn't used at all. But it could be to put a
> temporary notice on the front page, for instance.
>
> I'm sure this didn't answer all your questions, but hopefully
> triggered some new ones... :)
>
------=_Part_1638_21757991.1346442048860
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Andreas, many thanks for your answers. Yes, we are looking at the system fr=
om different perspectives so I would love to clarify if I understood your p=
oint properly. For the sake of an example say that the page looks like this=
:<br><br>section header-copy-1 (some header + some copy)<br>A dynamic table=
<br>section header-copy-2 (another header + another copy)<br>A dynamic grap=
h<br><br>I would like to generate the table and the graph using custom modu=
les (say the data is coming from an external server which I need to consume=
and process).<br><br>According to your description I can create two page r=
esources for section header-copy-1 and header-copy-2 using the web GUI and =
then one template to layout both sections, the table and the graph on a web=
page presented to the user. If I edit either page resource (header-copy-1 =
or header-copy-2) then the web page will be updated automatically when the =
template pulls them from the database next time the web page is requested. =
Is my thinking correct?<br><br>If yes, then is there any easy way of refere=
ncing a particular page resource created using the web GUI in a template? I=
understand I could use m.rsc[id] but the id is not shown by the web GUI (t=
here is an integer in the url and a unique name assigned in the GUI but I a=
m not sure if either can be reliably used to reference a page resource).<br=
><br><br>On Friday, August 31, 2012 7:56:11 PM UTC+1, Andreas Stenius wrote=
:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bo=
rder-left: 1px #ccc solid;padding-left: 1ex;">templates is quite different =
from resources (pages).
<br>
<br>A resource holds data, but no presentation. The template is used to
<br>layout and present the resource data.
<br>Somewhat like html vs. css for separating the data from the
<br>presentation (design).
<br>
<br>> 1. If I create this page as a template, can I edit the template us=
ing the
<br>> editor from the admin section e.g. to correct any typos or the who=
le copy or
<br>> header without opening the template file?
<br>
<br>There is currently no way to edit the templates via the web GUI. The
<br>idea is that the templates are rarely changed,
<br>after they've been developed; but resources are created and edited
<br>continuously.
<br>
<br>> 2. Can I create the page using the HTML editor from the admin sect=
ion and
<br>> somehow include the call to the module to include the dynamic tabl=
e?
<br>
<br>I would have the design in a template, and get the data from pages. So
<br>you create the content in the admin.
<br>No need to call a custom module.
<br>
<br>> 3. Say I would like to have a few configuration options for genera=
ting the
<br>> table (e.g. number of rows for the sake of an example). Can I some=
how
<br>> include such configuration option in the admin section of the site=
once the
<br>> module to generate the table has been enabled?
<br>
<br>There's a config model you can use from your template if you need
<br>configuration per site: <a href=3D"http://zotonic.com/documentation/719=
/m-config" target=3D"_blank">http://zotonic.com/<wbr>documentation/719/m-co=
nfig</a>
<br>
<br>> 4. Sometimes a page is build using only a template, but I can stil=
l edit the
<br>> page in the admin section (e.g. the homepage of the blog exemplary=
site).
<br>> The HTML editor doesn't show any text, it's empty. What is the pur=
pose of
<br>> showing that editor for a page that is shown only from a template?
<br>>
<br>
<br>It depends on the what the template does with the content of the page.
<br>In the case above,
<br>maybe the content isn't used at all. But it could be to put a
<br>temporary notice on the front page, for instance.
<br>
<br>I'm sure this didn't answer all your questions, but hopefully
<br>triggered some new ones... :)
<br></blockquote>
------=_Part_1638_21757991.1346442048860--
------=_Part_1637_14068321.1346442048860--