External redirect to parent node

Author Message

Marc Boon

Thursday 16 March 2006 1:35:18 pm

Is it possible to do an automatic redirect to the parent node by a template override or otherwise?
I want to have clients redirect to the parent node if they type in a url of a folder which does exist, but where no viewable content is stored, and I want to prevent to give the client a default folder view of that node. So I want them to move up one level by external redirect, until a node is reached which contains viewable content.

Betsy Gamrat

Friday 17 March 2006 6:26:30 am

You could use <b>/error/kernel/20.tpl</b> and then have javascript handle the redirect.

Basically, assume the parent is valid and strip off the last element of the current url (in location.href), then you can use location.href="new url" to handle the redirect.

(Starting point - code in <b>/error/kernel/20.tpl</b>)


{literal}
<script>alert(location.href);</script>
{/literal}

Marc Boon

Friday 17 March 2006 6:50:12 am

The error template would never be used, because there is no error.

I want the default (not overridden by my node templates) Folder view to do the redirect.
So I should probably have a override for the Folder class as the last line in my override.ini.append. But what do I specify there, that is the question.

I would rather not use javascript, but generate a HTTP 301 redirect to the parent node.
How to do that?

Matthew Carroll

Thursday 09 November 2006 8:52:53 pm

A little late to the party, but I was looking for something else and found this. On the off-chance this is still useful Marc, the way to do this would be to use the RedirectOperators extension:

http://ez.no/community/contribs/template_plugins/redirect_operators

I do this kind of redirect to a child node, but the principle is the same - see this thread:

http://ez.no/community/forum/setup_design/auto_redirect_to_a_sub_item

Matthew

http://carroll.org.uk

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 01:13:58
Script start
Timing: Jan 19 2025 01:13:58
Module start 'layout'
Timing: Jan 19 2025 01:13:58
Module start 'content'
Timing: Jan 19 2025 01:13:58
Module end 'content'
Timing: Jan 19 2025 01:13:58
Script end

Main resources:

Total runtime0.0297 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 590.2969152.6250
Module start 'layout' 0.00540.0030 742.921939.4453
Module start 'content' 0.00840.0189 782.367293.4609
Module end 'content' 0.02730.0023 875.828134.3047
Script end 0.0296  910.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00279.1192140.0002
Check MTime0.00124.1682140.0001
Mysql Total
Database connection0.00072.393510.0007
Mysqli_queries0.00268.879730.0009
Looping result0.00000.044210.0000
Template Total0.00175.710.0017
Template load0.00093.067110.0009
Template processing0.00082.616210.0008
Override
Cache load0.00061.998910.0006
General
dbfile0.011639.163680.0015
String conversion0.00000.029740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs