google-code-export / django-page-cms

Automatically exported from code.google.com/p/django-page-cms
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Add ability to parse pages shown through show_content tag. #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've created a basic navigation page which is included on every pages base
template.

I'm using the show_content tag to display it.

I dont want to hardcode links and my template code would look like ...

=========================
{% load pages_tags %}
<h2>Navigation</h2>
<ul>
    <li><a href="{% show_absolute_url "home" %}">Home</a></li>
=========================

Problem is that you cannot render an included page through the template
system thus these tags dont work. I also dont want to use the menu tags
since I plan to use a custom template tag inside the include as well...

Any ideas or workarounds for the time being?

Original issue reported on code.google.com by AcidTo...@gmail.com on 9 Jul 2009 at 7:53

GoogleCodeExporter commented 9 years ago
I'm currently using a workaround i thought I'd share in case anyone else wants 
this
behavior.

Create your include page against an empty template with a single placeholder. 
Add
your links in order by just specifying the slug 1 per line. Make its status 
hidden.

Then inside the base template for the real page add code similar to whats below
changing things when appropriate.

{% get_content "main-navigation" "include_content" as navigation %}
<ul>
{% for item in navigation.split %}
    <li><a href="{% show_absolute_url item %}">{% show_content item "title" %}</a></li>
{% endfor %}
</ul>

Original comment by AcidTo...@gmail.com on 9 Jul 2009 at 8:26

GoogleCodeExporter commented 9 years ago
"Problem is that you cannot render an included page through the template
system thus these tags dont work"

Can you elaborate what you mean by this? I made some change to the backend 
lately
that can maybe break things. Do you use the trunk version?

Original comment by batiste....@gmail.com on 10 Jul 2009 at 9:14

GoogleCodeExporter commented 9 years ago
I'm using trunk. I'll elaborate a bit more.

I have two page templates. One is a full document which all my user visible 
pages
inherit from. The other is a blank document with a single placeholder.

My base template has a navigation area which is simply loaded from a page 
created
from the blank template in order to edit links directly from the admin area 
without
duplicating content on each page inherited from the base template.

My idea was to create a page inheriting from the empty template that contains 
just a
list of my navigation links, and that page would be imported into my base 
template
page. That way I have a single "include" page on the admin which contains links
displayed for every page inheriting from my base template.

I'm using the {% show_content "my-links-page-slug" "links" %} tag which is 
hardcoded
into the base template and places the links directly into my navigation area.

That works fine and dandy except my links include page uses tags so I dont have 
to
hardcode the actual URLS.

My include links page looks something like

{% load pages_tags %}
<h2>Navigation</h2>
<ul>
    <li><a href="{% show_absolute_url "home" %}">Home</a></li>
    <li><a href="{% show_absolute_url "about" %}">About</a></li>
    <li><a href="{% show_absolute_url "blahblah" %}">Blah Blah</a></li>
</ul>

But since there is no way to have the {% get_content %} tag render the fetched 
page
through the template. I actually get the tags on the link-include page displayed
rather than parsed. As in my links when displayed actually point to "{%
show_absolute_url"

Does that make sense? I understand you have a tag for generating a list of 
links but
I need to use other tags on this include page so I'm still needing 
functionality.

Thanks for your time and hopefully this is more clear.

Original comment by AcidTo...@gmail.com on 10 Jul 2009 at 2:02

GoogleCodeExporter commented 9 years ago
It even more confuse :-). 

What is links links stuff that you use ? {% show_content "my-links-page-slug" 
"links"
%} You are not supposed to handle links by yourself.

If you have specific complex needs, do try to put too much in the template, 
just put
that in a view, or write a new template inclusion tag. It would be easier and 
cleaner.

Original comment by batiste....@gmail.com on 14 Jul 2009 at 7:28

GoogleCodeExporter commented 9 years ago
Without any news, I close this bug because it's not clear enough

Original comment by batiste....@gmail.com on 23 Sep 2009 at 3:07