Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. Why do you need the "../"? Shouldn't it be absolute from domain root "/en/contact/contacts-done/" Since you say you loose the post vars, try to inspect in console while posting, it tells you if it get's redirected. You just have to find the correct url that doesn't do it. Usually you just use $page->url in the language you are and post it to itself, then redirect after it was successful to show a success message. It's called PRG pattern http://en.wikipedia.org/wiki/Post/Redirect/Get to avoid getting send again when using back button or refresh etc. Edit: Just wanted to mention since I don't think it's good to post a contact form to a "done" page, what if there's form errors you want to show the form again?
  2. I don't know. How does the english url look then?
  3. You'd link to the wire directory from wherever folder on your server. This doesn't work cross server. It's like an like a shortcut linking to a folder. So you create a symlink inside each domain where the wire folder would be, and the link points to the real wire folder. There's tons of infos on the internet just search http://en.wikipedia.org/wiki/Symbolic_link
  4. <form role="form" action="../<?php $config->urls->root;?>contatti/contatti-invio/" method="post" > will be like... ..//contatti/contatti-invio/ ? Apart from that you have the italian url here so I'm not sure how you get the english one?
  5. Actually it would be nicer if those avatars would link to the developer. Instead of justhe a picture.
  6. You'll find all infos here http://processwire.com/api/multi-language-support/multi-language-fields/ $page->title is a string and not an object, so you need to turn off outputformatting first for the page.
  7. One way is just symlink the wire directory into your websites directory.
  8. https://packagecontrol.io/search/processwire
  9. If you have template cache enabled you have additonal options appearing for defining GET or POST variables on which cache is not enabled. So enter some GET or POST vars you have in your form and it works.
  10. I would try something like this: http://stackoverflow.com/questions/8432601/wamp-xampp-localhost-responding-very-slow
  11. Must be something with you locall server. Sometimes excessive virtual hosts or inefficient hosts settings can cause slowdown. I wouldnt look in PW.
  12. I think kongondo is close You can build top level entries using a PageArray. Only top level items are supported, once MSN got a PageArray it will recursively parse the tree from those top level entries. You could do this $items = new PageArray(); // add pages to PageArray $home = $pages->get("/"); $items->add($home); $events = $pages->get("/events/"); $items->add($events); $photos = $pages->get("/photos/"); $items->add($photos); $options = array( "selector_field" => "nav_selector" ); $nav->render($options, null, $items); but now make use of the "selector_field" option https://github.com/somatonic/MarkupSimpleNavigation#added-support-for-nav_selector-propertyfield-and-selector_leveln-new-in-121 default it is "nav_selector". When MSN finds a page with this property (either field or added at runtime) it will take that value as a selector to find/filter the children (if it has any). So if you want to have a custom selector on the "/events/" page it would look like this: $items = new PageArray(); // add pages to PageArray $home = $pages->get("/"); $items->add($home); $events = $pages->get("/events/"); $events->nav_selector = "limit=5, sort=-eventdatefield"; // define a selector $items->add($events); $photos = $pages->get("/photos/"); $items->add($photos); $options = array( "selector_field" => "nav_selector" ​); $nav->render($options, null, $items); Now adding a additional item at the end is something I would add using JS (jquery). And also let the "Events" top menu entry link to the full list anyway. To get something to target the JS script you could use "inner_tpl" with a placeholder to add name or id to ul's and add that to the options array: $options = array( 'selector_field' => 'nav_selector', 'outer_tpl' => '<ul id="nav">||</ul>', 'inner_tpl' => '<ul id="{name}">||</ul>', ); Then do something like this with JS $("#nav ul#events").append($("<li><a href='/events/'>more</a></li>"));
  13. Just thinking about it again jan's example, I think you guys are right in that if the php is in the cached template itself it wouldn't work as that code would never get executed, but remember that you can define GET vars on template settings, where when present to not cache the page. But you can also use a page for those calls without caching or use a php script bootstrap PW. Considering using template cache with a js inline call to a url that is current page with a GET var "mysnippet". Enter a cache time and add "mysnippet" to the "Cache disabling GET variables" appearing underneath. Now consider this snippet: $content .= "<script src='{$page->url}?mysnippet=bit'></script>"; if($input->get->mysnippet == "bit"){ header("Content-Type: application/javascript"); echo "document.write('<div class=\"bit\">');\n"; foreach($page->images->find("sort=random") as $img) echo "document.write(\"<img src='$img->url'>\");\n"; echo "document.write('</div>');"; exit(); } Will output random sorted images from the page in a template cached page. Edit: This only works when you use delayed output, hence the $content .= opposed to the direct echo "..." inside the condition, since this allows you to exit the script and not get other markup output before or afterwards. Same example $content .= $page->body; $content .= "<script src='{$page->url}?mysnippet=bit'></script>"; if($input->get->mysnippet == "bit"){ $images = ''; foreach($page->images->find("sort=random") as $img) { $images .= '<img src="' . $img->url . '">'; } header("Content-Type: application/javascript"); echo <<<_MKP document.write('<div class="bit">$images</div>'); _MKP; exit(); } $content .= $page->sidebar;
  14. Why shouldn't jan's example not work? I used a similar tchnique just recently. The image src is just a static url to return a random image. Of course in this case it's only good to serve one image src, limited to whatever image, but I think most of the time theres a need to do a little more with little junks of HTML. That's where js or str replace come in next.
  15. Most of what we do in templates has little to do with Pw solution. 99 is plain php js HTML and css. There's no Pw out of the box way. If I understand correctly you enable template cache for whole page but want a little part dynamic. So you're left with js or street replace output with php (again not pw). Using markup cache might be possible with an easy template but don't think worth of caching all 'around' that little dynamic part. Also markup cache has a fixed expire time you set and not by rules like when a page updates. If you're afraid of js I would try catching output with hook on Page::render and str_replace the parts you need. Once using procache instead of template cache eBen this won't work cause no php and mysql. So you're left with js again.
  16. RT @dazzy_web: If you want control over your cms instead of your cms controlling you then check out #processwire http://t.co/GodXxokLII

  17. http://lmgtfy.com/?q=processwire+contact+form+api
  18. Some time ago I added support to core for repeaters, but it's very vage and uncomplete and only works with = operator. So it's already there for some time. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/InputfieldWrapper.php#L316 Thing was that it wasn't saving those fields anymore because of something else related, I can't really remember now. To enable fields with sowIf getting saved see in wire/config.php how to make it work. /** * Settings specific to InputfieldWrapper class * * Setting useDependencies to false may enable to use depencencies in some places where * they aren't currently supported, like files/images and repeaters. Note that setting it * to false only disables it server-side. The javascript dependencies work either way. * * Uncomment and paste into /site/config.php if you want to use this * * $config->InputfieldWrapper = array( * 'useDependencies' => true, * 'requiredLabel' => 'Missing required value', * ); * */
  19. RT @processwire: New blog post: ProcessWire Core Updates (2.5.14) – A Week of Multiples: Modules and User Templates/Parents – https://t.co/…

  20. Difficult without seeing code but if you define an id for the inputfields dependencies doesnt work as it requires a certain id.
  21. RT @espiekermann: I’m not much of a Facebook user, but just updated my cover image to #jesuischarlie https://t.co/91tXycr2bn (AG Bold + Blo…

  22. I gladly refer you to the docs http://processwire.com/api/multi-language-support/code-i18n/
  23. How stable is this version? I plan to try this for a recent project that's going live soon. Thanks for the work put into this!
×
×
  • Create New...