Jump to content

diogo

Moderators
  • Posts

    4,296
  • Joined

  • Last visited

  • Days Won

    79

Everything posted by diogo

  1. refer to this http://processwire.com/talk/topic/4114-как-вставить-flash-в-структуру-сайта/
  2. Nico, I love how this looks like and where you are going with this. but the pages pan doesn't work for me as it is. on my laptop it just pushes the content to outside the screen on the right, and it doesn't feel natural that a menu item does something different from the others... Still, I love this theme and would like to help finding a solution if you are open for it
  3. In my experience, clients understand and accept very well when you tell them that you created some constrains on purpose. The important is that they look at their website and their friend's website and see why theirs looks much better.
  4. You can use an html parser to, both, create the templates in PW and pull the content to the database. It's some work, but perfectly doable.
  5. I looked a bit better at the whole code (i confess I didn't before...). The wire() method is needed because the code is inside a function (variables, like $page, don't work inside functions but methods, like wire() do http://php.net/manual/en/language.variables.scope.php). So keep it as it is. I don't have time to look at the tutorial and understand the problem with $category. What you can do for now to get rid of the error, is define the variable before that if check: $category = "";
  6. Very nice Tiago!! Two suggestions: 1. You could show how many postcards are in the July tab by simply counting them (count()) and rendering their top (no need to load the text), because now it seems that it's empty. 2. When I turn the postcard I can see for a moment the paper in white because the image starts loading only then. I would start loading it as soon as you show the front.
  7. Ok, as I thought, this code is the problem $thisCategory = wire("page")->name; if($thisCategory !="news") { $category = "news_categories_01.name=" . $thisCategory; } When you click a category in the list, the page is not called "news" anymore, so the $category variable is not set. That's why it's missing. You have to adapt the code so that the categories pages are also included on that if check. -- On your second problem: wire("page") holds the current page being viewed, so when you use it on the homepage, that's the page that will be called by it, and not "news" as you want. To correct this, you will have to change wire("page") by wire("pages")->get(1234), where 1234 would be the id of the "news page". That will work everywhere. I'm not sure why you are using wire() in this code, but in case this is not a conscient decision, just wanted to clarify that wire('page') is the same as $page, and wire('pages') is the same as $pages.
  8. Hello Ben, welcome to the forum. First issue is odd... are you using a custom theme? As for the 404, it works for me... can you see if it works when you visit this: www.yourdomain.com/fr/jksndkjbskjdjds where the segments are: [your domain] / [second language name] / [random blob]
  9. Go the template "advanced" tab, and add the fields you want to the "List of fields to display in the admin Page List" input
  10. What's the name of the page where this code is being used?
  11. What I used here was a ternary operator, that in this case works as an else/if clause. Check an explanation here http://robertsettle.com/2012/07/php-shorthand-if-statements/ Soon, you will be knowing PHP without even noticing
  12. filter() alters the pageArray for good. Do this instead: $stuff = $page->all_list; $stuff2 = $stuff->find('parent.name!=thing');
  13. Uliverse, read my solution again. It doesn't work with RTE and doesn't force any order since editor can drag the pages(blocks) to order them
  14. Check if the field is filed before outputting the tags. Here's one way of doing it: // create a variable for each field that includes the html tags only if the field is populated $link_text_01 = $banner->link_text_01 ? "<a href='{$banner->link_01}' target='_blank'>{$banner->link_text_01}</a>" : ""; // inside the echo replace the entire element by the variable
  15. Hm, if I understand you correctly there is still not a way to do it as you imagined it. I'm assuming you want the ability for the editor to add groups of fields in the page admin and fill them directly there, a bit as having repeaters with individual templates (this was discussed before somewhere). You can go with Martijn's solution. Hanna code works very well. Or you can do the same directly in the page tree. --page two ----block one (template=text) ----block two (template=accordion) --page two ----block one (template=text) ----block two (template=images) ----block three (template=text) The editor would create a new page in the tree, and those block as children of it. To choose what kind of block, they would choose the template while creating it (you can limit the templates selectable for pages of this kind). To output it on the parent page template: foreach($page->children as $c){ echo $c->render(); }
  16. http://processwire.com/talk/topic/1036-markupsimplenavigation/?p=22887
  17. I know you won't resist to look here one more time, so I will answer Might be that I'm working with PW and in this forum for too long, and am overlooking some difficulties that people might have. So other approaches to make people feel at home are welcomed for sure. As for the official Docs, and for the way PW works (where some things have to inevitably be assumed), choices have to be made, and those belong to Ryan with the help of us all (so, keep proposing). I can't help to be a bit sad that you interpreted mine, and others, responses like this. Again, we are talking about the official docs. How can you write documentation without deciding how you want people to learn? When you teach, you are always deciding how others will learn... and tough choices have to be made.
  18. Zahari, not wanting to be elitist here, by the contrary. I think PW can be learnt by absolutely everyone that has the will. Better yet, all the knowledge that you get from learning PW will be useful in general and not only for working with this tool. I just think it's dangerous to start copy/pasting without understanding, and I'm not saying that you will do that, but I'm sure that lots of people will if the pieces of code are at hand... About the documentation... also not saying that it can't be better (although I really like it as it is), just that there is a concept in it. It's not that it has been left incomplete by lack of time or something. The goal of it being so small is that you can read it all in some hours and be confident that you will be ready to start right away. Truth is it worked for me and also for some others. As soon as I finished reading it, I started working with PW. And I wasn't just doing things like wondering how to change the sidebar to the left, or how to remove a link from the navigation, like I was in other CMS's that I've tested before. I was immediately building from scratch, even without being a coder. And that's priceless.
  19. I know people learn in different ways, but in my opinion, the existing documentation (it's on the site, you can't miss it) goes through all the important concepts that are needed to begin with PW. As a bonus, it even teaches you some PHP basics. After (and only after) reading the documentation, the default install is also a great place to learn. I agree that a snippets library would be very useful, but certainly not for learning. I completely disagree that we should have a place where beginners start learning how to do small tasks without completely grasping the basic concepts of $page and $pages. That's how all the bad habits begin. That's how Javascript once almost ruined the web
  20. You can also redirect to the desired link. Put the page there so you have the link on the nav, and on the template: <?php $pageID = 1; $session->redirect($pages->get(10)->url.'?id='.$pageID); // 10 is the ID of the "Edit Page" page in the admin This is a simple redirection, and it's not the ideal of course...
  21. This doesn't have anything to do with permissions, since you don't want to use the admin. The process for this is triggering the PHP code, usually by submitting a form. Here is a very simple example: <?php // on the top of the template file, before any code that echoes content if($input->post->submit){ $title = $sanitizer->text($input->post->title); $p = new Page(); $p->template = $templates->get("basic-page"); $p->parent = $pages->get(1); $p->title = $title; $p->save(); } ?> <!-- later on, echo this form --> <form name="input" method="post"> title: <input type="title" name="title"> <input type="submit" value="Submit" name="submit"> </form>
×
×
  • Create New...