Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. That wasn't a good idea, you didn't say anything really wrong there, but now it looks like you did... And the referee was too quick with the yellow card
  2. Lea Verou explains Regular Expressions. This is actually very easy to follow! Her RegExp playground is pretty cool too http://leaverou.github.io/regexplained/. And since we are at it, check out this Regexp editor by Cody Lindley http://jsfiddle.net/codylindley/u4E6P/
  3. Hey, you both, calm down will you?
  4. Think of the template file as a puzzle, and the inc files as the pieces of the puzzle. The goal is to draw an html file in the browser, and each piece does it's part. Because php doesn't understand html tags, the pieces of the puzzle don't correspond necessarily to the complete html tags, they just draw the puzzle from top to bottom, unaware of what they're drawing, until it's complete.
  5. Thanks NooseLadder, didn't know this. One of my favourite albums is "the Pixies Peel Session, that starts with an amazing version from "honey pie" from the Beatles. Not good for programming though I'm listening to my playlist for working on grooveshark http://grooveshark.com/playlist/Diogo2/29241870
  6. The home page is the parent of all other pages. You can rename it if you want.
  7. Most of the examples that you will find here on the forum use the first method, and thats's also the one I tend to use, but the second method has it's merits. If you worry about how the source code looks (before firebug and chrome developer tools it was important for debugging) the second method respects the indentation and keeps the html tidy, although you can also achieve that inside a php with \t and \n (tab and newline characters): echo "\t\t\t<li><a href='{$planet->url}'>{$planet->title}</a></li>\n";
  8. @pwired, i think Macrura's 'wiring' has the same origin as the 'wired' in 'pwired', and not in 'wireframing'
  9. Welcome jzvanenk! Answering directly to your question. The snippets don't go inside the fields, they go directly on the template files. The code you have on the template files is PHP, just like the snippets yo are talking about. So, when you have this on the planets tutorial: <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <h1><?php echo $page->title; ?></h1> <h2>Type: <?php echo $page->planet_type; ?>, Age: <?php echo $page->planet_age; ?> years</h2> <p><?php echo $page->planet_summary; ?></p> </body> </html> You can also have this: <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <header> <ul id="all-planets"> <?php // list all planets and link to their pages foreach($pages->get("/planets/")->children as $planet){ echo "<li><a href='{$planet->url}'>{$planet->title}</a></li>"; } ?> </ul> </header> <h1><?php echo $page->title; ?></h1> <h2>Type: <?php echo $page->planet_type; ?>, Age: <?php echo $page->planet_age; ?> years</h2> <p><?php echo $page->planet_summary; ?></p> </body> </html> edit: that is the same as this (entering and leaving php to write html): <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <header> <ul id="all-planets"> <?php foreach($pages->get("/planets/")->children as $planet): ?> <li> <a href="<?php echo $planet->url; ?>"><?php echo $planet->title; ?></a> </li> <?php endforeach; ?> </ul> </header> <h1><?php echo $page->title; ?></h1> <h2>Type: <?php echo $page->planet_type; ?>, Age: <?php echo $page->planet_age; ?> years</h2> <p><?php echo $page->planet_summary; ?></p> </body> </html>
  10. (but wait! there is someone acting very suspicious...)
  11. Globaly, it's allways deactivated since you won't use it anymore. It would only work without JS. Sure, I would be interested. Just tell me when it has to be done
  12. Maybe you could simply deactivate the gallery link and use all the h5 to close the panel. $('h5.side-title a').click(function(){ return false; }); then you could: $('side_container.slide.active h5.side-title').click(){ //code for closing });
  13. The explanation was a bit confusing... What is the container? What is the link? What does it mean when the container is not active? edit: Not that, I guess this must be because the page is being worked on
  14. what??
  15. You don't need it to be a real link. just give the whole area a class and bind the click event to that class. then, remove the class when the area is clicked. To style that class to look like a link you only need cursor:pointer. $('.linkClass').click(function(){ $(this). animate({'margin-left':0}). removeClass('linkClass'); });
  16. I like your idea, but it's also very simple to do this only with css http://www.hongkiat.com/blog/css3-attribute-selector/, or if you really want it to be crossbrowser you can also do this in php: echo "<a href='{$f->url}' class='file-". get_file_extension($f) . "'>" and use the class on the css. edit: not saying my solutions are better though
  17. diogo

    What me impressed today

    ...and the typography
  18. Glad you solved it. Welcome to the forum ps: moved the topic to "General Support"
  19. My point exactly. You wouldn't want php newbies to be looking at your first years code for sure edit: just to clarify. I'm not saying that you shouldn't look at code from others, and in this particular place, you can rest assured that Ryan's code will have very few inconsistencies or errors. But when not knowing the basics, you can be confused even by small tricks used by more experienced developers, like purposely assigning a value to a variable inside a condition if($summary = $page->summary) //do something if $summary exists
  20. @photoman I'm not sure if this is what you want, but here goes: <?php foreach($page->children as $child) { echo $fredi->render("all|the|fields|you|want", $child); echo $child->render(); } ?>
  21. The lesson to take here is that you shouldn't be looking at php code without learning at least the basics. IMO the best way to start is by reading a good introdutory book on php, and only then start looking at code from others.
  22. Did you load fredi before? $fredi = $modules->get("Fredi");
  23. It's good practice because if you make a mistake and write "=" instead of "==", the first one will give you an error and the second will mess everything by assigning "home" to $page->template without giving any warning.
  24. What happens with render is that the $page object is momentarily replaced by the rendered page, so if you render a page inside the homepage, and in that page template you compare $page != $homepage, this will always be true. By doing like I did, you are comparing the real url in the browser with the rendered page url. This means that if the page it's called directly, the real url and the url from the $page object will match, but if the page is rendered from another page they won't.
×
×
  • Create New...