Blue Horn

Uncategorized

sfSimpleGoogleSitemapPlugin

June 7, 2010 by Sid in Uncategorized with 18 Comments

Just a thread where people can leave comments/discuss about sfSimpleGoogleSitemapPlugin, a Symfony plugin that I originally wrote more than a year ago.

18 Comments

  1. OlivierJanuary 14, 2011 at 1:14 am

    Hi,

    Thanks for this plugin.
    I am wondering how to deal with the sf_culture, if I want to do a multilanguage site.

    regards

    Olivier

  2. OlivierJanuary 14, 2011 at 1:17 am

    Hi,

    I noticed something else. I am using routes that are based only on one word (no module, no action), unfortunately the plugin force me to provide an action and a module, if a route can be specified it could be great.

    regards

    Olivier

  3. SidJanuary 14, 2011 at 1:24 amAuthor

    You can use routing, check the readme under ‘Configuration’ section … if you use routing url (like: @myroute), the plugin should ignore the module and action

  4. SidJanuary 14, 2011 at 1:27 amAuthor

    You might need to extend the plugin for the sf_culture.

  5. Miguel ÁngelMarch 29, 2011 at 12:39 pm

    Hi,
    First of all thanks for this plugin, it’s helping me a lot.
    I’m Trying to filter de records but I got two issues:
    1st: I like to filter by the result of the function “notPublished” that is check the object and related objects (instead one single column). Is it possible to ignore the column field and check the function for every object?:
    – { column: block, method: notPublished, operator: = , value: 0 }

    2nd: How can I set a dynamic value for a criteria. I need to check that the finish date is greater than current date:
    – { column: finish, method: getFinish, operator: > , value: now() }

    Anyway this second question is not required once the fist is solved.

    Thanks!!

  6. SidMarch 30, 2011 at 10:05 am

    Hi Miguel,

    Sorry, at the moment they are not possible with the plugin. Currently the plugin just passes the criterias to either Doctrine, Propel or DbFinder.

    I’ll have to work on adding those extra functionalities, but I’m currently very busy with work.

    If you happen to add those functionalities, let me know and I’ll add it to the plugin so other people can use it.

    Cheers

  7. Miguel ÁngelMarch 31, 2011 at 9:38 am

    I’ll work on it!!
    Again, thanks for this plugin.

    Cheers

  8. Miguel ÁngelApril 5, 2011 at 2:35 am

    I’ve made some modifications, they worked for me (and surely there would be a cleaner way to get this). They just check the “method” indicated in the criteria when the “column” is not set. I modified sfSimpleGoogleSitemap.class.php

    To ignore those criterias without column just added one line to queryUsingPropel method:
    = if ($criteria_array and is_array($criteria_array))
    = {
    = foreach ($criteria_array as $crit)
    = {
    + if (!isset($crit['column']) || $crit['column']==”) continue;

    To execute the method indicated in the criteria I added the following lines to processConfig() method:

    = // if there’s any result
    = if ($objects and (is_array($objects) or ( $orm == self::ORM_DOCTRINE and $objects instanceof Doctrine_Collection )))
    = {
    = foreach ($objects as $obj)
    = {

    + if ($criteria_array and is_array($criteria_array))
    + {
    + $ignore_object = false;
    + foreach ($criteria_array as $crit)
    + {
    + if (isset($crit['column']) && $crit['column']!=”) continue;
    + $operator = ($crit['operator']==’=’?’==':$crit['operator']);
    + $value = $crit['value'];
    + $method = $crit['method'];
    + if (!eval(‘return ‘.($obj->$method()?’1′:’0′).$operator.$value.';’))
    + {
    + $ignore_object = true;
    + break;
    + }
    + }
    + if ($ignore_object)
    + continue;
    + }

    Sorry I have not added this functionalities to DbFinder or Doctrine.
    Hope It’s useful.

  9. Jevgenijs SpruzhsApril 15, 2011 at 11:23 pm

    Hi!

    I am using your plugin sfSimpleGoogleSitemapPlugin and I found one small
    issue which is quite small and really easy to fix. I have multicultural
    environment and I need to extend sfSimpleGoogleSitemap and redefine
    processConfig method. The problem is that $gsgxml in
    sfSimpleGoogleSitemap is private. The plugin could be much more flexible
    if you define this variable as protected, so I am able to use it in my
    class.

  10. SidApril 15, 2011 at 11:28 pmAuthor

    Hi Jevgenijs,

    I will make it protected on the next release

    and I’ll also look at adding the functionality posted by Miquel

    Cheers

  11. Sharo BaroJune 30, 2011 at 3:31 am

    How can I specify a timestamp criteria in the app.yml file?

    I need something like this:
    criteria: # criterias to filter the records to include in the sitemap
    – { column: schedule_at, method: ScheduleAt, operator: < , value: timestamp() }

    What is the proper syntax for that ?

  12. SidJune 30, 2011 at 11:04 amAuthor

    Try this:

    { column: schedule_at, method: ScheduleAt, operator: < , value: current_timestamp }

  13. Yordan LazarovJuly 14, 2011 at 10:30 pm

    How to join TABLE?

  14. SidJuly 15, 2011 at 8:14 pm

    Hi Yordan,

    It doesn’t support joins, but you can create stored view on MySQL and create a Propel class for it.

    Sid

  15. PazzoDecember 10, 2011 at 7:21 am

    Hi!
    this worked for my date comparison:

    – { column: start_date, method: StartDate, operator: <, value: '’ }
    – { column: end_date, method: EndDate, operator: >, value: ” }

  16. PazzoDecember 10, 2011 at 7:25 am

    sorry… how to write php code?!?

    – { column: start_date, method: StartDate, operator: <, value: '’ }
    – { column: end_date, method: EndDate, operator: >, value: ” }

  17. PazzoDecember 10, 2011 at 7:27 am

    aaarrg

    – { column: start_date, method: StartDate, operator: , value: ” }
    value is ‘echo date(‘Y-m-d’, time())’

    written in “php code inside yaml” style

  18. shayanJune 20, 2013 at 4:17 pm

    hi thanks for your useful plugin
    in sue it but have some error thant do not know how to fix

    Warning: constant(): Couldn’t find constant sfSimpleBlogPostPeer::TABLE_NAME in /var/www/company_project/rakeban/base_shop/plugins/sfSimpleGoogleSitemapPlugin/modules/sfSimpleGoogleSitemap/lib/sfSimpleGoogleSitemap.class.php on line 201 Fatal error: Class ‘Criteria’ not found in /var/www/company_project/rakeban/base_shop/plugins/sfSimpleGoogleSitemapPlugin/modules/sfSimpleGoogleSitemap/lib/sfSimpleGoogleSitemap.class.php on line 204

Leave a reply

Your email address will not be published. Required fields are marked *

*

thirteen − two =

My Projects
Restaurant Websites
Websites