Jump to content

Most recent posts only updated in default language


caribou
 Share

Recommended Posts

Here's an odd problem. Suggestions welcome!

In one of my templates, I list the 5 most recent items. After installing multi-language, the default (English) contiues to work as expected.

In the other language, the recents stopped updating the day I installed the module. See attached.

Edit: On further exploration, anywhere I list pages in any order, pages created after I installed the module don't show up in any language but default. Compare the recent updates menu here:

http://wwfgap.org/tracker/jaguar/puerto-iguazu/

and here:

http://wwfgap.org/tracker/es/jaguar/puerto-iguazu/

Here's the code:

<?php 	
$recents = array();			
foreach($pages->find("template=placemark, limit=5, sort=-created") as $placemark){ 

	$since = $placemark->created;
	$since = date("Y-m-d",$since);
                    
        $recents[] = "<li><a href='{$placemark->parent->url}'><img src='{$placemark->parent->icon->url}' alt='icon'>{$placemark->parent->parent->parent->title}: {$placemark->parent->title}</a><br><em>{$since}</em></li>";
            
}
                
$recents = implode($recents);
echo "{$recents}";

?>

post-785-0-19876200-1403204190_thumb.png

post-785-0-81499800-1403204190_thumb.png

Link to comment
Share on other sites

Further research - this only happens if I specify the template in the query.

So this shows all recent pages of any type in any language:

    $placemarks = $pages->find("sort=-created, limit=5");
    foreach($placemarks as $placemark){
		$since = date("Y-m-d",$placemark->created);
        echo "{$since}<br/>"; 
	}

But this only shows pages created before I installed the multilanguage module, if I access any language other than the default (foo.com/es instead of foo.com, for example).

$placemarks = $pages->find("sort=-created, limit=5, template=placemark ");
foreach($placemarks as $placemark){
	$since = date("Y-m-d",$placemark->created);
        echo "{$since}<br/>"; 
}

Which indicates that by installing the module, something changed with my templates - but what?

Link to comment
Share on other sites

More sleuthing! I'm a regular Sherlock over here.

Only one template is exhibiting this problem. The only difference between this and other templates is that it doesn't have a template file associated with it. I created a file for it, but it didn't make a difference. I'm stumped.

To sum up,

  • If I look for sort=-created, limit=5, I get the same results at foo.com and foo.com/es.
  • If sort=-created, limit=5, template=x, same results at both
  • But if sort=-created, limit=5, template=y, I get the expected results at foo.com, but at foo.com/es, It only gets pages added before I installed the multilanguage modules. I haven't made any other changes to template y.

Any ideas on troubleshooting template y?

Link to comment
Share on other sites

That worked! I just added this to my form after retroactively updating the other ones:

 <?php foreach ($languages as $language){
        echo "<input type='hidden' name='status{$language}' value='1'>"; //Make active in all languages
        }
 ?>

Thanks very much for your help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...