Jump to content

DrMx

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by DrMx

  1. Wow that seem a better solution thanks a lot, can i find info related to that concept somewhere or is experience knowledge? I was struggling to match the subcategory with a tag, but i just found the answer =)
  2. I just found the answer as: <?php foreach ($page->find('parent=/category/subcat1/|/category/subcat2/, sort=-published') as $new) { echo $new->title.'<br>'; } ?> I suppose that it was a silly question after all.. As you can see i'm not an expert programmer but i'm trying =) Still i'm wondering if i can improve the /category/ part of the code..
  3. Hi I want to organize my page tree as home > category > subcategory > post and already made a separate tags page (all fine in that) Categories may have multiple subcategories in itself. And i want to organize this way for a better visual understanding of where to make every post entry. Problem is i want to list posts by date related at other posts level, and i can only order posts under their parents.. Don't know if i make sense. I had attached an image: Left side is my page tree at PW admin, center is the tree structure that i get with the first code (which i can use in another page, but not home) and right is what i want to accomplish. This is my home.php code for the tree structure (respecting parents) <?php foreach ($page->find('parent=news') as $cat) { echo 'parent page<br/>'; foreach ($cat->children('sort=-published') as $new) { echo $new->title.'<br/>'; } } ?> And i made this code using templates, each post having a template related to category. This second example works fine, but i want to know if there's another direct way to accomplish this without the need to create a template for each category? <?php foreach ($page->find('template=news, sort=-published') as $item) { echo $item->title.'<br/>'; } ?> Thanks in advance, i have two months aprox learning Processwire and has been great even if i didn't understand everything =p
  4. Hi Thanks for the links, i´m not a PHP expert so i got all day figuring out how to make the redirect in any page, that because i saw the options at the docs, but i think an automatic action could be better for many people. And just now got this to work: $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); if($lang == "es"){ $var = substr($page->url,8,3); //8 cause im in localhost at the moment if($var != "es/"){ header("location:".$page->localUrl("es")); } } else{echo "non spanish";} If there is something i can improve please let me know, and i don´t know if it would work if being cached. I don´t have any problems with fields. Edit: I read the info at the internationalization link and have my answer now. Thanks!
  5. Hi Im a designer with a WordPress background but i really want to migrate to ProcessWire, so i had been reading the docs for some weeks now, and just recently started to develop a local site. What i have been struggling with ML is this: 1. I get to redirect the root site using htaccess, but works only for the root. Is there a way that can work for other pages? ex. User enter "host/dir/content" and is redirected to "host/es/dir/content" RewriteCond %{HTTP:Accept-Language} ^es [NC] RewriteRule ^$ http://demohost/es [L,R=301] 2. I understand that Site Translation Files, are for my static template text? ex. I have a default "index" static text, i can use STF to display "indice" in spanish instead? If so, how do i create that file? I didn´t found info about that. If is for another use.. How and where do i translate my static template text? I used to got it working in WordPress with some plugin and this kind of code, don´t know if i can use something like it in ProcessWire: <?php _e(" <!--:es-->indice<!--:--> <!--:en-->index<!--:--> "); ?> =o
×
×
  • Create New...