Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. You only have to move all the folders and files from inside 'pwire' to the root. Make sure you move also the hidden .htaccess
  2. You can also do the contrary, if you want to change the homepage last, keep the index.html, and the server will get it instead of index.php. From there you can change the links one by one has you move the pages.
  3. Looks very nice!
  4. works perfectly Nico! edit: although it tells me that all files are 0MB. Should be measured in KB maybe
  5. Alex, have a look at this book. I like the way it's structured http://www.amazon.com/PHP-MySQL-Web-Development-4th/dp/0672329166
  6. I assumed it would work by doing this. But it should be working by default...
  7. @raydale I didn't use the module yet, but i would say that you have to look for that page in the tree, and edit it to assign to it the module process.
  8. Same as me Forget the dummies book, apparently it has some typos. I chose to tell you about that one because it focuses on the sintax and on how to write PHP, while others go into SQL queries and reading files for example, and PW already takes cares of those for you.
  9. Slightly off topic, Why don't you load jQuery from a CDN like they recommend on the Fancybox website? Loading times should be better because tat copy of jQuery may be already cached on the user browser.
  10. Via cheatsheet
  11. Ryan, did you consider MarkitUp as an option for imputfield type when using markdown or textile formatters? http://markitup.jaysalvat.com/
  12. In the way your code is written, if you put a for each statement between date and body, you have to finish the echo statement with a colon, and start another echo after. To keep the same logic has you have, can go like this: foreach($posts as $post) { echo " <li><a href='{$post->url}'>{$post->title}</a> <p><strong>Date:</strong> {$post->date}</p> "; foreach($post->image as $image) { //code for the images here } echo " {$post->body} </li> "; } Your code is very confusing because of all those copy/pastes. Maybe you could look at each block and choose your favorite way of writing the code. Than you can apply that logic to all the code. For instance, the same code as above, can be also written in a completely different way. Here I'm coming in and out of php, and keeping the structure of html more visible: <?php foreach($posts as $post) { ?> <li> <a href='<?=$post->url?>'><?=$post->title?></a> <p><strong>Date:</strong><?=$post->date?></p> <?php foreach($post->image as $image) { ?> <!--code for the images here in html--> <?php }?> <?=$post->body?> </li> <?php } ?> For a start PHP book have a look at "PHP 5 For Dummies" by Janet Valade. No kidding
  13. Thanks for the correction Ryan, and sorry Alex. It's even simpler than what I wrote
  14. Thanks for the tips Ryan! I will make those changes edit: hm, I think I won't implement the second tip. For a matter of privacy, I think an unsubscribed email should be immediately deleted.
  15. <?=$page->title?> is a shortcut to <?php echo $page->title?> to use the first form, it has to be supported by your server, so if your not sure, use the second form. In the same way as <? is a shortucut to <?php If you don't mind typing more, I would advise to use the complete version. You can use the same template for all categories. It should be something like this: <?php //find all the articles that have this category $articles = $pages->find("categories=$page"); //for each article found, print the fields you want foreach ($articles as $article) { echo "<h2>" . $article->title ."</h2>"; echo "<div class="body">" . $article->body ."</div>"; } ?> I didn't tested the code. Don't rely completely Maybe you could read an introduction to PHP. It's not difficult, and would help a lot to understand all this.
  16. Good site Marty! It fits Andrea's work perfectly. I would like to be able to look at the background images (i know they work only as background, but still, they are nice). Have you considered giving the chance to hide the content by clicking on the background for instance? It could come back on a second click.
  17. Your categories are in an array, so you have to iterate through them like this <? foreach ( $page->categories as $category ) { echo category->title . '<br/>'; }?> or, how i would probably do it: <? if ($page->categories){ echo '<ul class="categories">'; foreach ( $page->categories as $category ) { echo '<li><a href="' . $category->url . '">' . $category->title . '</a></li>'; } echo '</ul>'; }?> Edit: I don't know if you prepared a template for the categories pages to list all the post of each one there. But, because it makes sense, I changed the second block of code to reflect this.
  18. I want to share with you guys the final solution that I implemented for this newsletter. So, I decided not to use any system like Mailchimp or Campaign Monitor (thanks for these and other suggestions, anyway). I wanted an extremely simple system, and decided to built it with PW instead. Collecting the emails is done in a very simple way: when the user inputs the email, it is sanitized and, if it doesn't exist, a new page with the email as title is created under a parent called "people". Like this I get a nice list of emails in the page tree. After this, the user gets a success message, and is sent a welcome email. $email = $sanitizer->email($input->post->email); if(!$email) { echo $pages->get(1023)->not_email; } elseif($pages->get("title=$email") instanceof NullPage) { $p = new Page(); $p->template = $templates->get("person"); $p->parent = $pages->get(1015); $p->title = $email; $p->save(); echo $pages->get(1023)->confirm; //send the email $to = $email; $subject = 'Willkommen'; $message = <<<EOT ...(here goes the html of the welcome email)... This email (and also the future ones) has a link for an unsubscribing page that looks for the imputed email and deletes it: $pages->get("title=$email")->delete(); if($pages->get("title=$email") instanceof NullPage) { echo $page->byebye; } else { echo $page->error; } The newsletter itself is also very simple. In this case we decided that periodically, the administrator will choose some of the posts from the blog to build the emails. So, I created a page "messages" that accepts children pages with a template that has only a date field and a pages select field. To send a message, the administrator creates a new page under "messages", chooses the blog posts that wants to include, publishes it and presses view. Here she is presented with a sample of how the email looks like, and a button "send" on the bottom. The email is sent, and she is redirected to the PW admin with a success message. Again, I kept it very simple because we wanted limited functionality, and maybe it needs some adjustments. But It could be much more complete, with the alternative to write a text and put images instead of only choosing the blog posts, for instance. And maybe even turned into a module.
  19. I agree. What I like most in Processwire is that you don't have to tweak absolutely nothing to get the results you want. It's better to have more work building something new on top of a simple system than hacking a very complete system that makes too many assumptions. I can't help with the programming, but I can always help testing
  20. It seems so. At least the ID's for the blog pagination links are "MarkupPagerNav"
  21. This is nice have a look on the sidebar: http://99lime.com/blog/
  22. I do like this solution. I digg a bit more on modules and saw that you also do something like: $pages = wire('pages'), and then use $pages->get(), and so on, just like in templates.
  23. Great! Thanks Pete
  24. I created a new page with parent and template "admin" and created a new module for that page process. Among other things, i would like to list there all the children of another page with a module. Is there any way of using template variables inside the module, or it has to be done another way? I looked on the forums, and tried to figure out by looking at other modules, but didn't find any answer.
  25. diogo

    Adminer

    Would be maybe more elegant like you say, but i already have a link in the page view. For now I will keep it like this
×
×
  • Create New...