Thanks Jelmer but my confusion is that the function you're mentioning
goes into the controller, yet the code I am working with is suppose to
go into the model. When I add the function to the model, how do I
make the controller get the $user_hash value? Specifically, I need to
take the $user_hash value and compare it from the model into the
controller like so
var $feed = array(
'conditions' => array('Thank.rss_hash' => '$user_hash'),
'titleField' => 'Thank.title',
'descField' => 'Thank.title',
'link' => '/thanks',
'orderby' => array('Thank.created' => 'DESC'),
'limit' => 10
);
but alas, it does not work. I get the error on my model of
Parse error: syntax error, unexpected T_VARIABLE in /Applications/MAMP/
htdocs_attractionapp/app/models/thank.php on line 6
Thanks so much for your help but I'm stuck. Right now I am kicking
myself that I didn't migrate to 1.2 before beginning this project! ;)
daniel
On Mar 8, 9:45 am, jelmer <[EMAIL PROTECTED]> wrote:
> You are indeed close, just add the has after the controller url, like
> this:
> my_controller/my_rss/user_hash
>
> it will automatically expect auserhashbecause that's what you've
> setup in the function: function my_rss($user_hash)
> sometimes you may also need multiple variables:
> function my_function($category, $url)
>
> the url structure will be like this:
> my_controller/my_function/category/url
>
> I hope you understand it now, pretty easy after all huh?
>
> On Mar 8, 7:21 am, dsgndvlp <[EMAIL PROTECTED]> wrote:
>
> > I guess I spoke too soon! I tried it and just realized its still not
> > working as I thought. Specifically my issue is that how can CakePHP
> > know that the user_hash part in my url
> > ofhttp://myapp.com/my_controller/my_rss/user_hash
> > is set without declaring a var
> > likehttp://myapp.com/my_controller/my_rss?user_hash=12048489009112
>
> > I tried using this in the controller but the explode keeps giving me
> > an error and I am not sure why. I am so close i can taste it too!
>
> > class Thank extends AppModel
> > {
> > var $name = 'Thank';
>
> > var $thispage = explode('/',$_SERVER['REQUEST_URI']);
>
> > var $feed = array(
> > 'conditions' => array('Thank.rss_hash' => '$thispage[2]'),
> > 'titleField' => 'Thank.title',
> > 'descField' => 'Thank.title',
> > 'link' => '/thanks',
> > 'orderby' => array('Thank.created' => 'DESC'),
> > 'limit' => 10
> > );
>
> > }
>
> > On Mar 8, 12:09 am, graphicdefine <[EMAIL PROTECTED]> wrote:
>
> > > Thanks so much Johan - this makes a lot of sense now. The
> > > clarification is super helpful!
>
> > > Take care,
> > > daniel
>
> > > On Mar 3, 8:56 am, "Johan @ Notitia.nl" <[EMAIL PROTECTED]> wrote:
>
> > > > With the example url (http://myapp.com/my_controller/my_rss/user_hash)
> > > > you should create a controller like this:
>
> > > > <?php
>
> > > > class MyController extends AppController {
> > > > $name = 'MyController';
> > > > $uses = array('MyModel');
> > > > $components = array('MyRssComponent');
>
> > > > function my_rss($user_hash = null)
> > > > {
> > > > if(!$user_hash)
> > > > {
> > > > $this->set('data', 'No UserHash defined');
> > > > }
> > > > else
> > > > {
> > > > $data = $this->MyModel->findAll(array('user_hash' =>
> > > > $user_hash));
> > > > $this->set('data', $data);
> > > > }
> > > > }
>
> > > > }
>
> > > > All you have to have now is a view which transforms the $data array to
> > > > a RSS feed.
>
> > > > On Mar 3, 7:06 am, graphicdefine <[EMAIL PROTECTED]> wrote:
>
> > > > > I tried getting this all working and am
> > > > > usinghttp://bakery.cakephp.org/articles/view/automagic-rss-feed-generator-...
> > > > > on my build of CakePHP 1.1.
>
> > > > > My only issue, is I don't understand how to find out thehashfor the
> > > > >userthat is given in the URL. For instance, in a URL
> > > > >likehttp://myapp.com/my_controller/my_rss/user_hashhowcanIonlyget the
> > > > > user_hash from the URL to compare to myhashin theusertable?
>
> > > > > Any help is super appreciated because I am just spinning my wheels at
> > > > > tthis point. I know I am soooo close to!
>
> > > > > Thanks,
> > > > > daniel
>
> > > > > On Jan 6, 1:19 pm, graphicdefine <[EMAIL PROTECTED]> wrote:
>
> > > > > > Thanks so much Williamg! I understand now!
>
> > > > > > I'm going to try this out tonight and let you guys know how it goes.
> > > > > > If I create any good code out of it I'll be sure to share.
>
> > > > > > Thanks so much,
> > > > > > daniel
>
> > > > > > On Dec 26 2007, 2:44 pm, Williamg <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hi Daniel, if you use the link I sent earlier.. you should be
> > > > > > > able to set up
> > > > > > > a quick and easy feed.
>
> > > > > > > Now, about customising it so that eachuserhas a unique URL, you
> > > > > > > could
> > > > > > > follow my earlier recommendation of adding ahashfield in your
> > > > > > > users table.
> > > > > > > ----------
> > > > > > > | users |
> > > > > > > ----------
> > > > > > > id
> > > > > > > username
> > > > > > > rss_hash
> > > > > > > -------------
>
> > > > > > > In your controller, (using the techniques) at that link i sent
> > > > > > > you can check
> > > > > > > if the request is anrssrequest.
>
> > > > > > > If it is, retrieve thehashfrom the url and get theuserfrom the
> > > > > > > database
> > > > > > > wherehash=hashretrieved from the url.
>
> > > > > > > That should work nicely. This will allow you to issue unique urls
> > > > > > > to each
> > > > > > >userwithout explicit authentication. Obviously if the data in the
> > > > > > >feed is
> > > > > > > sensitive then you probably want to add a few security measures
> > > > > > > to the above
> > > > > > > method. I hope this helps..
>
> > > > > > > P.S: I use cake 1.2
>
> > > > > > > On Dec 26, 2007 6:11 PM, graphicdefine <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Thanks for the response! That sounds easy enough but i am not
> > > > > > > > sure
> > > > > > > > what the method should look like. My usual login code?
>
> > > > > > > > On another note, I thought CakePHP 1.2 is only for production
> > > > > > > > and not
> > > > > > > > live sites yet? I was under this assumption so I've been
> > > > > > > > coding this
> > > > > > > > site in CakePHP 1.1
>
> > > > > > > > Thanks so much,
> > > > > > > > daniel
>
> > > > > > > > On Dec 26, 6:16am, "Dr. Tarique Sani" < [EMAIL PROTECTED]>
> > > > > > > > wrote:
> > > > > > > > > Oops! change the "presume" to "you should" ;)
>
> > > > > > > > > Tarique
>
> > > > > > > > > On Dec 26, 2007 4:45 PM, Dr. Tarique Sani < [EMAIL PROTECTED]>
> > > > > > > > wrote:
>
> > > > > > > > > > On Dec 26, 2007 10:57 AM, graphicdefine <[EMAIL PROTECTED] >
> > > > > > > > wrote:
>
> > > > > > > > > > > Forgive me for my perhaps naive question, but does anyone
> > > > > > > > > > > know how I
> > > > > > > > > > > can offerRSSfeeds on my site for each individualuser?
> > > > > > > > > > > Originally
> > > > > > > > I
> > > > > > > > > > > was thinking of attempting to create a password-protected
> > > > > > > > > > > feed, but
> > > > > > > > I
> > > > > > > > > > > have never done that before and couldn't find any
> > > > > > > > > > > documentation of
> > > > > > > > any
> > > > > > > > > > > other bakers whom have tried.
>
> > > > > > > > > > I presume you are using cake 1.2 and also presume that you
> > > > > > > > > > have
> > > > > > > > > > createdrssfeeds using cakephp before - just create a feed
> > > > > > > > > > like any
> > > > > > > > > > other... create a method to accept an md5 unique id as a
> > > > > > > > > > param
>
> > > > > > > > > > So your URL will look like
> > > > > > > > > >http://yourdomain/your_controller/your_rss_action/md5id.rss
>
> > > > > > > > > > Should work....
>
> > > > > > > > > > HTH
> > > > > > > > > > Tarique
>
> > > > > > > > > > --
> > > > > > > > > > =============================================================
> > > > > > > > > > Cheesecake-Photoblog:http://cheesecake-photoblog.org
> > > > > > > > > > PHP for E-Biz:http://sanisoft.com
> > > > > > > > > > =============================================================
>
> > > > > > > > > --
> > > > > > > > > =============================================================
> > > > > > > > > Cheesecake-Photoblog:http://cheesecake-photoblog.org
> > > > > > > > > PHP for E-Biz:http://sanisoft.com
> > > > > > > > > =============================================================
>
> > > > > > > --
> > > > > > > Gbolahan Williams
> > > > > > > --
> > > > > > > This message contains confidential information and is intended
> > > > > > > only
> > > > > > > for the individual named. If you are not the named addressee you
> > > > > > > should not disseminate, distribute or copy this e-mail. Please
> > > > > > > notify the sender immediately by e-mail if you have received this
> > > > > > > e-mail by mistake and delete this e-mail from your system.
>
> > > > > > > E-mail transmission cannot be guaranteed to be secure or
> > > > > > > error-free
> > > > > > > as information could be intercepted, corrupted, lost, destroyed,
> > > > > > > arrive late or incomplete, or contain viruses. The sender
> > > > > > > therefore
> > > > > > > does not accept liability for any errors or omissions in the
> > > > > > > contents
> > > > > > > of this message which arise as a result of e-mail transmission.
> > > > > > > If
> > > > > > > verification is required please request a hard-copy version. This
> > > > > > > message is provided for informational purposes and should not be
> > > > > > > construed as a solicitation or offer to buy or sell any
> > > > > > > securities or
> > > > > > > related financial instruments.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---