[OT] helpers url absolute vs relative

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[OT] helpers url absolute vs relative

whisher
Hi,
I notice that other framework like laravel
if you using helpers give you an absolute url
while zf2 give you relative url so I'm wondering
what are the pros and cons.
Thanks in advance and sorry for the ot ^^
Bye
Reply | Threaded
Open this post in threaded view
|

Re: [OT] helpers url absolute vs relative

Frank Brückner
Hi Wisher,
please look at the "basePath" view helper:  
http://framework.zend.com/manual/2.2/en/modules/zend.view.helpers.base-path.html

Kind regards,
Frank

Am 03.09.2013, 20:55 Uhr, schrieb whisher <[hidden email]>:

> Hi,
> I notice that other framework like laravel
> if you using helpers give you an absolute url
> while zf2 give you relative url so I'm wondering
> what are the pros and cons.
> Thanks in advance and sorry for the ot ^^
> Bye
>
>
>
>
> --
> View this message in context:  
> http://zend-framework-community.634137.n4.nabble.com/OT-helpers-url-absolute-vs-relative-tp4660901.html
> Sent from the Zend Framework mailing list archive at Nabble.com.

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: [OT] helpers url absolute vs relative

Marco Pivetta
In reply to this post by whisher
It really depends on how you setup your routing. If the route includes a
domain, or is chained with a domain route, then you'll get your domain in
the output.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On Tue, Sep 3, 2013 at 8:55 PM, whisher <[hidden email]> wrote:

> Hi,
> I notice that other framework like laravel
> if you using helpers give you an absolute url
> while zf2 give you relative url so I'm wondering
> what are the pros and cons.
> Thanks in advance and sorry for the ot ^^
> Bye
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/OT-helpers-url-absolute-vs-relative-tp4660901.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|

ThemeManager

Juan Pedro Gonzalez
Hi,
I'm not sure if this fits here... I'm quite new to Zend Framework 2, but looking through the code of the framework itself and some other modules/libraries I've started the development of a ThemeManager library. The library is located at:
https://github.com/shadowfax/zf-themes
I would be very pleased if someone could take a look at it and send me comments on bad practices I've made or bad code (I guess there should be some of those), if someone would contribute that would make me even happier (but not asking so much).
My main goals are:
Maintain ZF2 views structureEasy to integrateAssets per module and theme.
I've found out some classes are difficult to extend. I've created a new Mvc/Application just for the init method so it loads my theme service and a bootstrap listener. If I could hook a global onBootstrap event I guess this could be neater however initializing the new class makes some sense as it is a theme application.
I've created a new feature for the modules which tells the ThemeManager that modules supports and makes use of themes. This way I add the view path from code. Basically instead of using the 'view' directory I use 'themes/theme_name' directory to hold the views in the same way the original directory did.... If no matching theme exists for a given module it uses the 'Default' theme.
Assets are located inside 'themes/theme_name/assets/'. The service creates a route named 'assets' (To be exact the one that is interesting is '/assets/module/wildcard'. This route is only used for matching and gives us one parameter which is the module name and a wildcard which is the path to the asset relative to the assets directory for the module. This way each theme may contain it's own assets.
Right now I've created one adapter which will use the directory structure and a json file that gives information about the theme. I'm planning on adding some new adapter for Database driven theme information (ZF2 database and Doctrine).
Thanks you for reading untill the end.
     
Reply | Threaded
Open this post in threaded view
|

RE: ThemeManager

demiankatz
I'm probably not going to have time to study your code closely at the moment (sorry, busy month), but I have built my own theme-management module for the VuFind project.  You can find it here:

https://github.com/vufind-org/vufind/tree/master/module/VuFindTheme

Feel free to take a look and borrow ideas if you see anything you like.  I've gone the route of completely separating the themes from the modules (there's a separate themes directory, and themes can inherit from one another), and I expose assets from within the themes directories using some Apache rewrite magic (see the top of https://github.com/vufind-org/vufind/blob/master/config/vufind/httpd-vufind.conf).

I'm happy to discuss particular issues if you have questions.

- Demian

> -----Original Message-----
> From: Juan Pedro Gonzalez [mailto:[hidden email]]
> Sent: Wednesday, September 04, 2013 7:11 PM
> To: [hidden email]
> Subject: [fw-general] ThemeManager
>
> Hi,
> I'm not sure if this fits here... I'm quite new to Zend Framework 2, but
> looking through the code of the framework itself and some other
> modules/libraries I've started the development of a ThemeManager library. The
> library is located at:
> https://github.com/shadowfax/zf-themes
> I would be very pleased if someone could take a look at it and send me
> comments on bad practices I've made or bad code (I guess there should be some
> of those), if someone would contribute that would make me even happier (but
> not asking so much).
> My main goals are:
> Maintain ZF2 views structureEasy to integrateAssets per module and theme.
> I've found out some classes are difficult to extend. I've created a new
> Mvc/Application just for the init method so it loads my theme service and a
> bootstrap listener. If I could hook a global onBootstrap event I guess this
> could be neater however initializing the new class makes some sense as it is a
> theme application.
> I've created a new feature for the modules which tells the ThemeManager that
> modules supports and makes use of themes. This way I add the view path from
> code. Basically instead of using the 'view' directory I use
> 'themes/theme_name' directory to hold the views in the same way the original
> directory did.... If no matching theme exists for a given module it uses the
> 'Default' theme.
> Assets are located inside 'themes/theme_name/assets/'. The service creates a
> route named 'assets' (To be exact the one that is interesting is
> '/assets/module/wildcard'. This route is only used for matching and gives us
> one parameter which is the module name and a wildcard which is the path to the
> asset relative to the assets directory for the module. This way each theme may
> contain it's own assets.
> Right now I've created one adapter which will use the directory structure and
> a json file that gives information about the theme. I'm planning on adding
> some new adapter for Database driven theme information (ZF2 database and
> Doctrine).
> Thanks you for reading untill the end.
>

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]