Jump to content

gebeer

Members
  • Posts

    1,394
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by gebeer

  1. I think for number 2 you need the $page->render() function. On the API Cheatsheet it says: Returns rendered page markup. echo $page->render();
  2. Where did you add the code? It should go into the code for the month menu <!-- NAVIGATION FOR MONTHS --> <div> <ul id='topnavmonths'> <?php $monthpage = $pages->get("/events/months/"); $children = $monthpage->children; foreach($children as $child) { $class = $page === $child || $child->children->has($page) ? " class='on'" : ''; echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; }; ?> </ul> </div> $page and $child represent the month page that you are currently on. $child->children represents the day pages of that month. has($page) now checks if the page we are currently on is in the day pages of the month we are in. This should do the trick.
  3. Hi Matthew, thank you for the hint. There's so many possibilities to discover. It's amazing. Cheers gerhard
  4. Thank you, Ryan, for sharing this with us. Using strip_tags and wrapping the output in <p> or whatever tags seems to be a great solution. And I don't think this needs to go in the core because everybody can implement their own favourite solutions.
  5. Thank you Soma Working great and so easy once you know it
  6. Hello all, this is a real beginner's question, I guess. Got stuck on how to select the nth child of a page. Couldn't find the right selector at the API cheatsheet or am just to stupid to understand them right. Also searched the forum. What I want to achieve is something like $page->child(2nd); I tried $page->child("start=2"); but the script then just stops there without throwing an error. I'm sure that should be pretty simple but have no clue atm. Thanks in advance gerhard
  7. Glad it helped. For keeping class on for month when you are on the day page: $class = $page === $child || $child->children->has($page) ? " class='active'" : ''; Worked fine for my case. Or the other way around like diogo suggested a few posts above: $class = $page === $child || $page->parents->has($child) ? " class='active'" : ''; Hope it helps. PS: nice picture from Bkk
  8. Try changing this line in your code $daypage = $pages->get("/events/months/$page->parent->name/"); to this $daypage = $page->parent; Give it a try and let us know.
  9. @pwired I stay there for max 5 month a time. So I get a tourist visa for 60 days with 3 entries which gives me 180days total and at the moment costs 90€. @Martijn I know that feeling.
  10. @BFD Calendar what is the $page->parent->name, when you are on a days page?
  11. I was asking if you visit Thailand often Ko Lipe is nice, indeed. I live in Ranong and love the little Island Koh Chang in the Andaman sea.
  12. Kop khun maak krap. Bai pratheet Thai boi mai?
  13. @Martijn cheers for the welcome. I can already see how PW can be addictive. Was sitting and playing around with it late last night, the night before and the night before...
  14. Hi Marcura, thanks for your thoughts on this. Custom error messages would sure be a great option to have in Form Builder. To build my own form code in the template and then use FB for processing seems like a little overkill to me as in my case I only need to send the form by email. As I saw in another thread, this should be fairly easy by using mail().
  15. @Soma Thank you for the suggestion. I would do the positioning by CSS only as a last resort. If it was up to me, generic error messages would be just fine. But unfortunately here my client has the say. So I need to do without Form Builder this time. Fortunately you posted great info on how to output forms in the frontend here in the forum. That should give me a good start. Cheers gerhard
  16. Hi Matthew, great to see you here and thanks for the warm welcome. Yes, my avatar is almost the same as in Seblod forum, only different color. The links you've posted are interesting and I totally understand some of the frustration with J! and Seblod. Working with PW is just so much smoother although the conversion will take me a while. So I might indeed throw some questions at the forum until I know my ways around this great piece of software better. So see you around. Cheers gerhard
  17. Hi Marcura, thank you for the info. Good point about customised error messages. I would need that, too. I'll join you with the feature request. Meanwhile I will have to code the forms by hand and use a jQuery validation script. Cheers gerhard
  18. Hello, I'm working on my first project with PW. Working with PW is amazing so far. As I am coming over from the Joomla world I am used to adding scripts to individual pages with a Joomla built in method. Searching for the PW way of doing this, I came along that post where I found this snippet of code: $config->scripts->add($config->urls->templates . "scripts/lightbox.js"); Great, I thought. But using just that snippet wouldn't include the script. I had to add a second snippet foreach($config->scripts as $url) echo "<script type='text/javascript' src='$url'></script>"; (which I also found in that other post) to actually load the script wherever I wanted in my template file. Lets assume you are working with the default PW Profile on a fresh install and want to load the lightbox.js only on the homepage and the template file for your homepage is home.php. Then you would include the first snippet in your home.php. The second snippet goes either in your head.inc into the head section or in your foot.inc at the bottom (whereever you prefer to load your js). This is a quite generic way to include scripts. If you wanted to have another script loaded only, lets say, on a contact page with template file contact.php the you just need to add a snippet, e.g. $config->scripts->add($config->urls->templates . "scripts/contact.js"); to contact.php. The second snippet foreach($config->scripts as $url) echo "<script type='text/javascript' src='$url'></script>"; already sits in your head.inc or foot.inc where you put it before and it will take care of including also contact.js because of the foreach loop. I guess that most of you already know this. But for a newbie like me I had to write this down to properly digest it and maybe it is helpful to someone else. Cheers gerhard
  19. Hello, I would like to have access control per field and wonder if this lies within the capacity of PW. Situation: Certain fields in the backend form for certain pages should only be visible to certain users. A regular user might fill data in fields title, fulltext etc. An admin user has additional fields available like meta_description etc. I'm fairly new to PW and can find access options in the template setup. But not in the fields setup. Is there a way to achieve this in PW? Thank you gerhard
  20. Hello all, before I start working with Form Builder on my project, I would like to know if it is possible to determine where the validation error messages get displayed in the form. My client requires to have validation errors put out underneath each individual field. Is this possible with the Form Builder module? Thank you gerhard
  21. Hello all, I'm pretty new to PW, coming over from the Joomla world. In J! there is a truncate method that does just that: truncate a piece of text. The problem with implode() or substr() is that it doesn't take html tags into account. So if I wanted to truncate a text that comes from a wysiwyg input, I might loose closing tags which can result in display/validation errors. So basically my question is: Does PW API provide a truncate method and if not what are your favorite ways to get this done? Thanks Gerhard EDIT: There seems to be a very popular PHP function for Truncate string while preserving HTML tags and whole words. And a slick jQuery plugin to limit text and expand to full length on click readmore: readmore.js
  22. Thank you diogo for the insight. I was thinking top to bottom. Your solution looks more logical, though. But all roads lead to rome, as they say
  23. Hello all, I'm new here and this is my first post. Found PW a couple of weeks ago and working on my first project. So far I can say it is fun developing with PW. I like the whole concept, the documentation is great and the forum is the best I have seen so far. I had the same problem with highlighting parent menu items when one of their children is the current page. Reading this thread and following the link in previous post, I came up with a solution that is working great for me. Here's my piece of code: foreach($page->rootParent->children as $child) { $class = $page === $child || $child->children->has($page) ? " class='active'" : ''; ?> <li><a<?php echo $class; ?> href='<?php echo $child->url ?>'><?php echo $child->title ?></a></li> <?php } ?> The bit that does the highlighting for parent menu items is $child->children->has($page) As easy as that I was first trying to solve it with native PHP strpos funtion before I realised that the PW API offers the has() function which really makes life a lot easier. If there are better ways to achieve the same goal, I would love to learn them. Cheers gerhard
×
×
  • Create New...