Hi,

Thank you very much for the response. I've created a slug and indexed  
it. Everything is working now.

Cheers,

Davinder

On May 23, 2007, at 12:55 PM, Fabian Lange wrote:

> Hello,
>
> you are right. The book doesn't say something about this. You could  
> assume that this works out of the box, but you have to do what you  
> did. The proposed way is to add a db column called slug, get the  
> getter and setter generated and set it to some url friendly value.
>
> Here a snipped of my app, tailored fore some known german titles:
>
>
>
> $v=utf8_decode($this->getTitle());
>
> $skipChars = array("&", "/", "-");
>
> $v = str_replace($skipChars, "", $v);
>
> $v = str_replace(array("Ö","ö","Ä","ä","Ü","ü","ß"),
>
> array("Oe","oe","Ae","ae","Ue","ue","ss"),$v);
>
> $v = preg_replace("/\s+/i","_",$v);
>
> return $v;
>
>
>
> .: Fabian
>
> From:  
> [EMAIL PROTECTED] 
> oups.com  
> [mailto:grbounce-3gx0ZwUAAACbeXgKRGBnB9JmBRJWwY06=fabian.lange=web.de@ 
> googlegroups.com] On Behalf Of Davinder Mahal
> Sent: Mittwoch, 23. Mai 2007 20:51
> To: symfony-users@googlegroups.com
> Cc: Davinder Mahal
> Subject: [symfony-users] Routing by slug.. getSlug missing?
>
>
>
> 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 symfony-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to