Forums / Setup & design / URL translation to extension URL w/user parameters?

URL translation to extension URL w/user parameters?

Author Message

Luis Cruz

Tuesday 27 February 2007 10:39:19 am

Running eZ 3.6 and trying to do the following. I have an extension at /foo and can
call it with user parameters, e.g., /foo/(bar)/foobar.

extension/foo/module/foo/module.php:

<?php
$Module = array('name' => 'foo');

$ViewList = array();

$ViewList[""] = array
    (
    "script" => "foo.php",
    "params" => array()
    );
?>

I would like to setup a URL translation to redirect /foobar to /foo/(bar)/foobar. I have tried setting up a "New system URL forwarding" and a "New virtual URL forwarding with wildcard" (with & without "Redirecting URL" checked). If I setup /foobar to redirect to /foo, that works perfectly fine. However, if I try to setup /foobar to redirect to /foo/(bar)/foobar, I get this error:

Undefined view: foo::(bar)

Tracing through the eZ kernel code, it appears that the whole process is treating (bar) as a view inside the contact module rather than realizing that I am calling the "empty" view with user parameters.

Am I not specifying the destination URL correctly? Or is this something that requires hacking the eZ kernel to handle?

Xavier Dutoit

Wednesday 28 February 2007 12:20:41 am

Hi

And just calling /foo works ? The syntax is /module/view not just /module ?

Otherwise, you can do the redirect from the apache mod rewrite config. Might be easier...
X+

http://www.sydesy.com

Luis Cruz

Wednesday 28 February 2007 4:27:01 am

Yes, both /foo and /foo/(bar)/foobar work if I enter them directly in my browser. The page renders as I would expect. I have found a partial solution at the moment; I first have to create the URL translation as /foo/(bar)/foobar. Then, I have to edit it to read /foo//(bar)/foobar. For some reason, creating it as /foo//(bar)/foobar does not work; it will only work after you hit the "apply changes" button after it has already been created. However, it does not seem to be passing the parameters along to the extension.

As for mod_rewrite, sure, I could do it that way, but it would be counterproductive for my purposes. I want people skilled enough to use eZ but not nearly skilled enough to mess around with Apache configuration to be able to see and manage URL translations in one place.

Luis Cruz

Wednesday 28 February 2007 8:33:04 am

I believe I have found a solution that requires a slight kernel hack. Now, I can define a system URL forward rule for /foo to go to /foo/(bar)/foobar, /foo/(foobar)/bar, etc.

To do this, I modified kernel/classes/ezurlalias.php, starting line 812, eZURLAlias::translate() from

        if ( get_class( $uri ) == "ezuri" )
        {
            $uri->setURIString( $uriString, false );
        }

to

        if ( get_class( $uri ) == "ezuri" )
        {
            $uri->setURIString( $uriString); //, false );
        }

I have run through my site and have not seen any issues caused by this change. Existing URL translations continue to work, and non-translated URLs continue to work. However, any change deep in the kernel bowels gives me pause. I'm hoping an official eZ rep/developer will see this and comment on if this has any repercussions for the overall system (or why you would want to not have full initialization going on in setURIString at this point).

EDIT: It does affect the system; if I type /foo/(bar)/foobar directly into my browser, the user parameters are not passed in. So, this definitely breaks something, but I don't know why. Back to the drawing board...

eZ debug

Timing: Jan 18 2025 15:05:24
Script start
Timing: Jan 18 2025 15:05:24
Module start 'content'
Timing: Jan 18 2025 15:05:25
Module end 'content'
Timing: Jan 18 2025 15:05:26
Script end

Main resources:

Total runtime1.0740 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.2891180.8125
Module start 'content' 0.00560.8595 770.1016558.1484
Module end 'content' 0.86510.2087 1,328.2500336.7422
Script end 1.0738  1,664.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.3646210.0002
Check MTime0.00150.1360210.0001
Mysql Total
Database connection0.00060.059110.0006
Mysqli_queries1.001893.28341970.0051
Looping result0.00220.20211950.0000
Template Total1.045197.320.5226
Template load0.00170.156020.0008
Template processing1.043497.158420.5217
Template load and register function0.00020.020610.0002
states
state_id_array0.00070.068610.0007
state_identifier_array0.00130.124320.0007
Override
Cache load0.00140.1298270.0001
Sytem overhead
Fetch class attribute can translate value0.00140.131530.0005
Fetch class attribute name0.00080.076650.0002
XML
Image XML parsing0.00090.080230.0003
class_abstraction
Instantiating content class attribute0.00000.000950.0000
General
dbfile0.00200.1854270.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs