Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Where clause with ending periods
  • I have an observer generating a slug base on peoples names. Some names have suffix like Jr. or Sr., so slugs generated are 'first-last-jr.'

    When I query this, the where clause strips the ending period, so I cannot do an exact match. Any way to remedy this?

    Thanks
    Rich
  • OK - let me retract this statement.
    It's the param method when it parses a URL segment.

    Anyway around this since I pass in the value to the URL?

    Thanks
    Rich
  • A dot in the URL is seen as the extension separator, which the Framework strips off. The only way to work around it is to disable 'strip_extensions' in the routing section of your config.php.
  • Is there a way to get the observer to strip that while generating the slug?
    Or just strip it myself when I save it?

    What would you suggest is a best work around?
    Thanks
    Rich
  • HarroHarro
    Accepted Answer
    The Observer_Slug uses Inflector::friendly_title() to generate the slug.

    And as far as I can see that strips the dot from the string passed, both in ASCII as in UTF-8 mode. So how your slug can contain a dot, I don't know. Which version of Fuel are you on?
  • I'm running version 1.4

    Reviewing friendly_title, It appears the '.' character is stripped. 

    if ($allow_non_ascii)
    {
    // Strip regular special chars.
    $str = preg_replace("#[\.;:'\"\]\}\[\{\+\)\(\*&\^\$\#@\!±`%~']#i", '', $str);
    }

    But upon testing, it seems to actually strip it.
    It must be in the example I happen to be working with
    has the dot for some other reason.


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion