Hello.
I think I got it. I wasn't thinking clearly. I have to create all the
functions myself and Slug would get getTitleSlug() where I would have
to add and replace '_' in the url, correct?
Doing so, and adding my own functions I was able to get it to work.
It'll be great just to get confirmation on that, just in case I am in
fact missing something.
Thanks,
Davinder
On May 23, 2007, at 11:50 AM, Davinder Mahal wrote:
> Hi,
>
> I'm following the book's method of routing by the slug. I've added
> the routing method, changed the links and created the action. But
> the page doesn't want to work. Instead I always get
>
> Warning: call_user_func_array() [function.call-user-func-array]:
> First argument is expected to be a valid callback, 'News::getSlug'
> was given in /opt/local/lib/php/pear/symfony/view/escaper/
> sfOutputEscaperObjectDecorator.class.php on line 64
>
> I've looked in the model and I can not find a getSlug() function
> anywhere. I created a basic getSlug function in the News.php class
> which returns a string, once I did this, the page loaded without
> the error and link with the returned string.
>
> Isn't symfony supposed to create the getSlug function itself? I've
> issued a propel-build-all, and a clear cache but nothing.
>
> Am I missing something? Or is symfony? I'm using symfony 1.0.2.
>
> I've searched the wiki, forums and lists, but i can't seem to find
> anything relevant.
>
> Any help will be great.
>
> Thank you.
>
> Davinder
>
>
> The following is my code;
>
> news_by_slug:
> url: /news/:slug
> param: { module: news, action: permalink }
>
> I've changed the links
>
> <?php echo link_to($news->getTitle(), '@news_by_slug?slug='. $news-
> >getSlug(), array('class' => 'newslink') ) ?></div>
>
> And i've created the action
>
> public function excutePermalink()
> {
> $news = NewsPeer::retrieveBySlug($this->getRequestParameter
> ('slug'));
> $this->forward404Unless($news);
> $this->news = $news;
> }
>
> >
Davinder S. Mahal
Principal / Lead Developer
DSM Cyber Media
http://www.dsmcybermedia.com
{-------------------------------------------------------}
internet & media development
Union City, CA
+011 510-489-4827
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---