Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. Do you have the logs for this error in your /site/assets/logs/errors.txt file?
  2. No, the fastest way is echo '<a href="'.$pages->get(2)->url.'">this way to the admin</a>';
  3. You shouldn't be changing the parents of pages like that. Use page fields to categorize the articles and you will be fine http://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/
  4. diogo

    Avatar for pwired

    Thanks, that worked
  5. diogo

    Avatar for pwired

    Horst, look at what your pictures did to my avatar...
  6. Welcome to PW alexeld, PW doesn't impose any way of structuring your files, so you are free to use any way that you prefer. I think you will find this thread very clarifying http://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/
  7. I don't mean that the array itself is useless, but echoing "Array" is. Like with pageArrays. the object returns an array, but echoing it turns it into a string with the page ids.
  8. @xeo, what you want to do is not the intention of the module. In PW the urls follow the structure of the tree, if you would shorten your urls like you are saying, there would be problems with pages overriding other with the same name. Imagine that you have a page called "About" in the root of the website (mydomain.com/about), and you would write an article with the title "About". You would have a problem because they would share the same url. If you want to have short urls for your articles, you can put them under a parent that is on the root, and has a short name (not short title) -home --about --contacts --articles (name: a) ---article1 ---article2 This way, your article1 url would be mydomain/a/article1 If you want to have an even shorter url for the articles (avoiding urls like: mydomain/a/my-new-article-with-a-very-very-veeeeeeeeery-long-title), you can create a system that accepts their IDs on the URL (mydomain/a/123): <?php // on top of the template file of the "articles" page ("/a/") // url segments have to be activated on this template if ($input->urlSegments) { // if there are segments in the URL $id = (int)$input->urlSegment1; // get the first segment ant turn it into an integer $myURL = $pages->get("/a/")->find("id={$id}")->first()->url; // get the url of the page with the id in the segment if ($myURL && !$input->urlSegment2) { // if page exists and there's not a second segment $session->redirect($myURL); // redirect to the correct page } else { throw new PageNotFoundException(); // if not, throw a 404 } }
  9. diogo

    Avatar for pwired

    This avatars thread is turning the forum upside down. With Host's new avatar I'm too scared to come to the forum after midnight
  10. Wouldn't it be $form->removeStatus(Page::statusUnpublished); instead?
  11. I'm not sure what you are doing, but maybe it will work if you change $form->parent = $page; to $form->parent = $page->parent; edit: adrian was faster
  12. if ($page->children->first()->parent->id === $page->get(28)->parent->id - 1)
  13. if( $page === $pages->get(1) )
  14. I agree that it sounds strange to upload the same image more than once to the system, but there is a gain in the way files are organized in PW. The fact that images are directly associated with pages makes it a lot easier to organize in most of the cases and more difficult that an image that is in use on the website is erased. It also makes it less probable that you have unused images wandering around because they get deleted with the page they are in. I really think it's rare that this needs to happen. If you predict that this will happen a lot, then maybe it's even good that the system forces you to organize everything in a more efficient way (not thinking of images, but of groups of images organized in special pages for them). If it will only happen once or twice, I wouldn't worry about the duplication...
  15. André is very serious on that photo
  16. Even for very simple changes, like correcting typos on the readme, youhave to fork the repo. This can even be done just by editing the file directly on the original github repo (I mean , on the website) This is what you will see: very handy
  17. Or even: echo $pages->get(2)->name
  18. I would go with the child pages strategy. the tree could be organized like this: home -home_content ---area1 (give meaningful names to these) ---area2 ---area3 ---... -about -whatever -etc "home_content" need a template, but not a template file. Not having the file will hide it and it's children from the website (see answer #17 below http://processwire.com/talk/topic/4487-homepage-with-multiple-content-areas/?p=47926). The "area" pages would have their own template files (no header, no footer, only their own markup): <h2><?php echo $page->title?></h2> <?php echo $page->body?> Then you can build the homepage like this: <body> <h1>Look at my nice areas of content!</h1> <section id="area1"> <?php echo $pages->get("/home_content/area1/")->render()?> </section> <section id="area2"> <?php echo $pages->get("/home_content/area3/")->render()?> </section> <section id="area3"> <?php echo $pages->get("/home_content/area3/")->render()?> </section> <section id="area4"> <?php echo $pages->get("/home_content/area4/")->render()?> </section> </body> edit: or, if you get easily tired of typing <body> <h1>Look at my nice areas of content!</h1> <?php foreach($pages->get("/home_content/")->children as $c) { echo "<section id='{$c->name}'>"; $c->render(); echo "</section>"; } ?> </body>
  19. Check the name of the admin page in the database just to be sure. The id is 2.
  20. diogo

    Avatar for pwired

    Or a normal hair
  21. diogo

    Avatar for pwired

    Oh jee...
  22. From the documentation of the module https://github.com/somatonic/MarkupSimpleNavigation#markupsimplenavigation-116 $options = array( 'parent_class' => 'parent', // overwrite class name for current parent levels 'current_class' => 'current', // overwrite current class 'has_children_class' => 'has_children', // overwrite class name for entries with children Those are the options that let you modify classes, check all the other options also. They are many
  23. diogo

    Avatar for pwired

    Pronto, back to my normal avatar and time for bed
  24. diogo

    Avatar for pwired

    What beard??
×
×
  • Create New...