Jump to content

diogo

Moderators
  • Posts

    4,296
  • Joined

  • Last visited

  • Days Won

    79

Everything posted by diogo

  1. That's the way to do it. And in pw you can: foreach($input->post->subject as $subject_id){ $student_page->subject = $pages->get($subject_id); }
  2. You do it as with the other fields, but pass it a page object instead of a string $p->page_field = $pages->get("/new/"); will replace the page tat is already there in a single page field, and add a new page to a multi pages field. In a multi pages field you can also pass a page array: $p->page_field = $pages->find("template=any"); Edit: to remove pages use remove(): $p->page_field->remove($pages->get("/new/")); Ryan, would be nice if this page would be updated with API info
  3. diogo

    Windows 8 (or 7+)

    A little bit of topic, but I wanted to say that I installed the daily build of the newcoming http://elementaryos.org/journal/tags/luna and I'm very impressed
  4. I thought of updating my bookmark to github but I will keep it like this so I can tell if it happens again
  5. There is something funky happening with the cheatsheet. It's working fine on Soma's Github. Edit: for those that need it, here is the link http://somatonic.github.com/ProcessWireCheatsheet/
  6. 12 days to go, it's time for those that didn't vote to do it. There is a link on the top of this page, but I will make it even easier for you http://www.cmscritic.com/critics-choice-cms-awards/
  7. You could use the name of the page for the title. I know it's redundant, but either than the space it takes, i don't see any disadvantage. edit: I didn't see netcarver's answer before posting
  8. Add it here: Options +FollowSymLinks -MultiViews For those who may be interested, apparently GoDaddy has multiviews enabled by default, and this can mess up some rules http://support.godad...che-multiviews/
  9. See if this works http://davidwalsh.name/mod_rewrite-htaccess-godaddy
  10. The B's are not aware where they are included, but they can ask: $pages_that_include_me = $pages->find("page_field=$page"); This will give you an array of all the pages that include the page you are in. Edit: Rereading your question I see that you where asking the opposite. Assuming that you want to list all B's that where included on any A page without repetitions, you can do this: foreach ($pages->find("template=B") as $b){ if($pages->find("template=A, page_field=$b")->count() > 0) echo $b->url; }
  11. Arjen answered directly to this question. The link he pointed to can help giving some answers to your other concern.
  12. inside phop you can do: echo "<img src='{$page->image->url}'/>"; and outside php: <img src='<?php echo $page->image->url ?>'/>
  13. Hey, welcome to the forum! If you just copied the code, I can't think of any reason why PHP would be outputing that... could it be the javascript generated by Artisteer doing it? Although it's a shot in the dark, can you test the site with javascript disabled?
  14. You could do it with str_replace(), but depending of what you want maybe javascript would be better. Have you consider it?
  15. You can try this instead: if ($user->hasPermission($permissions->page-view, $page)) edit: see correction from Ryan on the next answer
  16. You're right, sorry... I understood wrong and complicated the simple. Try this on the home template: if(!$session->noPop){ echo "POP!"; $session->noPop = 1; } edit: netcarver beat me to it
  17. you can use session for this. Something like this should work: if($page->template == "home"){ if($session->noPop){ // No popup }else{ // Go popup!! } }else{ if(!$session->noPop){ $session->noPop = 1; } }
  18. I've never seen a panther fly... but if they would it would be more elegantly than a pig for sure
  19. There's nothing too complicated about it. PHP works in PW templates as it work everywhere else, if you understand how PHP works, you will also understand how it works with PW Answering your question: (although, honestly, I don't really get why you want to spread the form all over your fields. Did you consider having the form on a fixed place, like a sidebar?) If you have a file that you include in all the templates where you need this (for example, head.inc in the default install), you can put the code on a function there, and call that function from any place that includes the file. in head.inc function subscribeForm($field){ $formCode = <<<FORM <!-- Begin MailChimp Signup Form --> <div id="mc_embed_signup"> <form action="http://link here" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <label for="mce-EMAIL">Subscribe to my mailing list</label> <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required> <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div> </form> </div> <!--End mc_embed_signup--> FORM; $result = str_replace("{{MCsignup}}", $formCode, $field); return $result; } in any template that includes head.inc echo subscribeForm($page->body); //you can use any field here The alternative would be to build a textFormatter module, but I think this case doesn't justify.
  20. Very nice!! Have a look at this solution by Apeisa for responsive images. It would at least cut some weight on the images for small screens.
  21. Yes, that's what it does. to make it more clear, here is the complete code: <?php $formCode = <<<FORM <!-- Begin MailChimp Signup Form --> <div id="mc_embed_signup"> <form action="http://link here" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <label for="mce-EMAIL">Subscribe to my mailing list</label> <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required> <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div> </form> </div> <!--End mc_embed_signup--> FORM; $body = str_replace("{{MCsignup}}", $formCode, $page->body); echo $body; ?> First we assign the form code to the variable $formCode using the heredoc sintax (look for it here http://php.net/manua...ypes.string.php to be aware of what it does and cautions to have while using it). Here I'm using <<<FORM and FORM; to delimit the code, but I could use any other word. Then we find the chosen shortcode inside the body field and replace it by the form code with str_replace(), and assign the result to $body. Finally we echo $body. The shortcode could also be anything like ##myform## or **signup**. Just make sure it's something you wouldn't use inadvertently in the text.
  22. you can also use a special tag and php to insert it in the right spot. lets say you put {{MCsignup}} where you want the form inside the body field, and in your template do: $body = str_replace("{{MCsignup}}", $formCode, $page->body); echo $body; i'm on mobile and doing this by heart, so you should check the correct form of str_replace because i might have messed up the order
×
×
  • Create New...