Re: Alternative Routing for RSS
The request handler can help out a great deal with that kind of thing. if ( $this-RequestHandler-isRss() ) { $this-Auth-allow('index'); } You can use the same if to make the rss version of an action return only the last 10 items or only items from the last week or whatever else you may have set slightly differently in your rss controller. My fuzzy point about parsing extensions is still valid I think. In the router you are setting up an url that doesn't use an extension (presses/rss). But in the view folder you are placing the view in the rss folder (i.e. setting up for parse extensions). Nothing states that any rss feed must use views\presses\rss\ as the folder... that is just a folder that parse extensions use to help you have two views for the same action. the folder-name relates to the extension... not really the type of view you are rendering so you don't have to use it at all in this case. Or just use /presses.rss as the url and you are done? /Martin On Feb 12, 6:36 pm, maestro777 isig...@gmail.com wrote: Martin, Thanks for the pointer. I did previously try the way you pointed out but it gave me the same error. Which kind of confused me even more. I understand your side note and the concept. The reason I am using rss_feed action instead of index.rss is because in my controller, the index is a authentication restricted whereas the RSS feed is a public access. Maybe I need to rethink my approach. Thanks Eddie for the link. I took a quick look and it looks similar to what I was doing. I'll check it in greater detail shortly. Appreciate both your inputs. On Feb 12, 5:06 am, Smelly_Eddie ollit...@gmail.com wrote: Maestro, I think this article may help you, Add RSS Feeds to your CakePHP Models;http://edwardawebb.com/programming/php-programming/cakephp/add-rss-fe... On Feb 12, 6:32 am, Martin Westin martin.westin...@gmail.com wrote: I am not really an expert on routing, but i'd say that you need to specify ext = rss like this Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'ext' = 'rss' ) ); Side note: Since your action is called rss_feed I assume that you don't really have a standard view for it, right? You only really need to mess with parse extensions when you want the same action to render in more than one way. For example if /presses/index lists all presses and / presses/index.rss lists them in an rss feed. Same controller different views. On Feb 12, 3:12 am, maestro777 isig...@gmail.com wrote: I'm trying to create an alternative routing for my RSS feed. In my Route config, I have the following: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'url' = array('ext' = 'rss') ) ); I have a rss_feed action created in the Presses controller. I could get to the feed without problem using the url : http://localhost/mysite/presses/rss_feed.rss But when I tried using the alternative route I have an error: Error: The view for PressesController::rss_feed() was not found. Apparently it was looking for the view at ..\mysite\app\views\presses \rss_feed.ctp instead of mysite\app\views\presses\rss\rss_feed.ctp I'd appreciate very much if someone should help shed some light on what I am not doing right. I have spent hours trying to figure this thing out without success. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Alternative Routing for RSS
Martin, I tend to agree with you that the rss folder is basically to have two views of the same name but different types. Like you said, since I'm only catering one view with the rss_feed action, it isn't all that important to have it in the rss folder. However if I move the view file one level up. It breaks. It will say: Undefined variable: rss [APP\views\presses\rss_feed.ctp And the code in question is: $this-set('items', $rss-items($presses, 'rss_transform')); Anyhow using rss_feed.rss (with rss extension) in the url works fine. I can live with that. I was simply curious to know if I could do it without specifying the rss extension. http://www.example.com/rss_feed instead of http://www.example.com/rss_feed.rss. base on the fact that in my Route file I have already specify the 'ext'='rss'. Apparently it didn't work for me. On Feb 13, 12:41 am, Martin Westin martin.westin...@gmail.com wrote: The request handler can help out a great deal with that kind of thing. if ( $this-RequestHandler-isRss() ) { $this-Auth-allow('index'); } You can use the same if to make the rss version of an action return only the last 10 items or only items from the last week or whatever else you may have set slightly differently in your rss controller. My fuzzy point about parsing extensions is still valid I think. In the router you are setting up an url that doesn't use an extension (presses/rss). But in the view folder you are placing the view in the rss folder (i.e. setting up for parse extensions). Nothing states that any rss feed must use views\presses\rss\ as the folder... that is just a folder that parse extensions use to help you have two views for the same action. the folder-name relates to the extension... not really the type of view you are rendering so you don't have to use it at all in this case. Or just use /presses.rss as the url and you are done? /Martin On Feb 12, 6:36 pm, maestro777 isig...@gmail.com wrote: Martin, Thanks for the pointer. I did previously try the way you pointed out but it gave me the same error. Which kind of confused me even more. I understand your side note and the concept. The reason I am using rss_feed action instead of index.rss is because in my controller, the index is a authentication restricted whereas the RSS feed is a public access. Maybe I need to rethink my approach. Thanks Eddie for the link. I took a quick look and it looks similar to what I was doing. I'll check it in greater detail shortly. Appreciate both your inputs. On Feb 12, 5:06 am, Smelly_Eddie ollit...@gmail.com wrote: Maestro, I think this article may help you, Add RSS Feeds to your CakePHP Models;http://edwardawebb.com/programming/php-programming/cakephp/add-rss-fe... On Feb 12, 6:32 am, Martin Westin martin.westin...@gmail.com wrote: I am not really an expert on routing, but i'd say that you need to specify ext = rss like this Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'ext' = 'rss' ) ); Side note: Since your action is called rss_feed I assume that you don't really have a standard view for it, right? You only really need to mess with parse extensions when you want the same action to render in more than one way. For example if /presses/index lists all presses and / presses/index.rss lists them in an rss feed. Same controller different views. On Feb 12, 3:12 am, maestro777 isig...@gmail.com wrote: I'm trying to create an alternative routing for my RSS feed. In my Route config, I have the following: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'url' = array('ext' = 'rss') ) ); I have a rss_feed action created in the Presses controller. I could get to the feed without problem using the url : http://localhost/mysite/presses/rss_feed.rss But when I tried using the alternative route I have an error: Error: The view for PressesController::rss_feed() was not found. Apparently it was looking for the view at ..\mysite\app\views\presses \rss_feed.ctp instead of mysite\app\views\presses\rss\rss_feed.ctp I'd appreciate very much if someone should help shed some light on what I am not doing right. I have spent hours trying to figure this thing out without success. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options,
Re: Alternative Routing for RSS
I am not really an expert on routing, but i'd say that you need to specify ext = rss like this: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'ext' = 'rss' ) ); Side note: Since your action is called rss_feed I assume that you don't really have a standard view for it, right? You only really need to mess with parse extensions when you want the same action to render in more than one way. For example if /presses/index lists all presses and / presses/index.rss lists them in an rss feed. Same controller different views. On Feb 12, 3:12 am, maestro777 isig...@gmail.com wrote: I'm trying to create an alternative routing for my RSS feed. In my Route config, I have the following: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'url' = array('ext' = 'rss') ) ); I have a rss_feed action created in the Presses controller. I could get to the feed without problem using the url : http://localhost/mysite/presses/rss_feed.rss But when I tried using the alternative route I have an error: Error: The view for PressesController::rss_feed() was not found. Apparently it was looking for the view at ..\mysite\app\views\presses \rss_feed.ctp instead of mysite\app\views\presses\rss\rss_feed.ctp I'd appreciate very much if someone should help shed some light on what I am not doing right. I have spent hours trying to figure this thing out without success. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Alternative Routing for RSS
Maestro, I think this article may help you, Add RSS Feeds to your CakePHP Models; http://edwardawebb.com/programming/php-programming/cakephp/add-rss-feed-cakephp-models On Feb 12, 6:32 am, Martin Westin martin.westin...@gmail.com wrote: I am not really an expert on routing, but i'd say that you need to specify ext = rss like this: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'ext' = 'rss' ) ); Side note: Since your action is called rss_feed I assume that you don't really have a standard view for it, right? You only really need to mess with parse extensions when you want the same action to render in more than one way. For example if /presses/index lists all presses and / presses/index.rss lists them in an rss feed. Same controller different views. On Feb 12, 3:12 am, maestro777 isig...@gmail.com wrote: I'm trying to create an alternative routing for my RSS feed. In my Route config, I have the following: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'url' = array('ext' = 'rss') ) ); I have a rss_feed action created in the Presses controller. I could get to the feed without problem using the url : http://localhost/mysite/presses/rss_feed.rss But when I tried using the alternative route I have an error: Error: The view for PressesController::rss_feed() was not found. Apparently it was looking for the view at ..\mysite\app\views\presses \rss_feed.ctp instead of mysite\app\views\presses\rss\rss_feed.ctp I'd appreciate very much if someone should help shed some light on what I am not doing right. I have spent hours trying to figure this thing out without success. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Alternative Routing for RSS
Martin, Thanks for the pointer. I did previously try the way you pointed out but it gave me the same error. Which kind of confused me even more. I understand your side note and the concept. The reason I am using rss_feed action instead of index.rss is because in my controller, the index is a authentication restricted whereas the RSS feed is a public access. Maybe I need to rethink my approach. Thanks Eddie for the link. I took a quick look and it looks similar to what I was doing. I'll check it in greater detail shortly. Appreciate both your inputs. On Feb 12, 5:06 am, Smelly_Eddie ollit...@gmail.com wrote: Maestro, I think this article may help you, Add RSS Feeds to your CakePHP Models;http://edwardawebb.com/programming/php-programming/cakephp/add-rss-fe... On Feb 12, 6:32 am, Martin Westin martin.westin...@gmail.com wrote: I am not really an expert on routing, but i'd say that you need to specify ext = rss like this Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'ext' = 'rss' ) ); Side note: Since your action is called rss_feed I assume that you don't really have a standard view for it, right? You only really need to mess with parse extensions when you want the same action to render in more than one way. For example if /presses/index lists all presses and / presses/index.rss lists them in an rss feed. Same controller different views. On Feb 12, 3:12 am, maestro777 isig...@gmail.com wrote: I'm trying to create an alternative routing for my RSS feed. In my Route config, I have the following: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'url' = array('ext' = 'rss') ) ); I have a rss_feed action created in the Presses controller. I could get to the feed without problem using the url : http://localhost/mysite/presses/rss_feed.rss But when I tried using the alternative route I have an error: Error: The view for PressesController::rss_feed() was not found. Apparently it was looking for the view at ..\mysite\app\views\presses \rss_feed.ctp instead of mysite\app\views\presses\rss\rss_feed.ctp I'd appreciate very much if someone should help shed some light on what I am not doing right. I have spent hours trying to figure this thing out without success. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---