Jump to content

Macrura

PW-Moderators
  • Posts

    2,776
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. thanks, nice idea and good example. sometimes i have a replacements table or textarea right in the editor; then i use {{tokens}} in the body to grab those values; (template does the runtime replacement). Sometimes you might have some boilerplate content that is reused in various places but needs to have certain terms replaced contextually to the page.. +---------+----------+ | search1 | replace1 | +---------+----------+ | search2 | replace2 | +---------+----------+
  2. No, it doesn't really work that way, but at the same time you are stating the obvious, and it won't ever be necessary to appeal to people who want plugins. @cssabc123, can you provide some examples of sites you have developed? For example some successful sites that run Wordpress with a lot of plugins? I have such sites, and it's no fun at all. Yesterday a WP ecommerce site broke on iOS9; 3 hrs to upgrade the template to fix it. When i login to this site there are alerts all over the admin about licenses that need to be renewed, plugin updates, and stuff like that. We can barely keep track of the plugin subscriptions needed to make this site work.
  3. the only snafu i encounter with delayed output is that i lose the syntax highlighting of the HTML when it's all inside quotes as well as no double cursor (in ST for example)... though i do use it a lot when constructing repeating elements like table rows, lists, galleries.. also with delayed output you can store the markup into the wire cache.
  4. maybe you don't need to used delayed output? it can make many things more trouble than it's worth. Have you tried the simple include head/foot method.
  5. it's just a lot better.
  6. you could do a string replace on <p><img to <img and /></p> to /> when outputting. or turn off auto paragraph but that probably would be bad config.autoParagraph = false;
  7. if you were going to use them on a particular template with url segments, that would be pretty easy to setup. the template itself would parse the hashid and deliver the page content. there would be some options for generating the hashed URL, it depends on how you are using it; you could use Kongondo's new module and create a link on the page editor to the hashedID URL of the page. or you could replace all of the page urls for a particular template something like this (untested): wire()->addHookBefore('Page::path', function($event) { include('./classes/hashids.php'); $hashids = new hashids('your_unique_salt'); $page = $event->object; if($page->template == 'some-template') { $event->replace = true; $hashedID = $hashids->encrypt($page->id); $event->return = "/$hashedID/"; } }); on the template you would need to decrypt the id and render the content
  8. yep - in my case we also hash the client ID: $client_key = $calendar->client_select->id; $ak_hashed = $sanitizer->text($input->get->access_key); $access_key = $hashids->decrypt($ak_hashed); if($client_key != $access_key[0]) exit('Invalid Access Key'); As Teppo points out, using 2 hash IDs, one for the the page and one for the user and then seeing if the user has access to that page is an additional security. In my case these are not users, but simple pages storing contact info; You could also get real PW users and then use ACL to check for access...
  9. Using Hashids you can accept encrypted page IDs in a querystring, decode them for use in selectors. Why would you want to do this? In my case I have a private calendar feed where each calendar is a page, but i don't want people seeing the page IDs and then possibly guessing another person's calendar id. 1.) include the hashids class, either with the composer or in my case i'm using the old version which is 1 php file (you can find this in the wordpress plugin version). 2.) Depending on which version you use, the method is different; read the docs to see which version you need; my code is relevant to the old 0.1.3 version which is good enough for this application. include('./classes/hashids.php'); $hashids = new hashids('your_unique_salt_here'); if($input->get->cal_id) { // the cal id coming in is a text hash ID: $cal_id = $sanitizer->text($input->get->cal_id); // decrypt the hash ID to the integer $cal_id = $hashids->decrypt($cal_id); // Look up the calendar: $calendar = $pages->get($cal_id[0]); if( !$calendar->id ) exit('Calendar not found.'); // at this point you would execute your actions, e.g. render your calendar feed etc.. exit(); } You would also need a way to generate your links wherever you are sending or displaying them, with the hashed ID. $calId = $hashids->encrypt($calendar->id);
  10. portable web server. with PW... bitnami?
  11. no problem.. have you echo'd what PW is generating for your $page->Header_select->contactAddress ?
  12. you would retrieve the email address like: $emailTo = $page->Header_select->contactAddress; BTW - you are mixing up your cases, your variable is camelCase, your page select is underscore_case with the first letter capitalized, and your page field is camelCase. For clarity and ease I would recommend at least being consistent with your field naming, e.g. always use underscore_case (no caps) or camelCase.
  13. no idea what you're talking about, but if you post some code and more info, it should be a piece of cake.... email is a strong point for PW (wiremail, mandrill integration...)
  14. yeah and if you misspell Processwire you'll be banned also
  15. Macrura

    ProcessWire Day

    We could drink Club Mate instead of coffee, for this 1 day
  16. you mean counting like this? $kids = $pages->find("template=poi, has_parent=$page"); $interests = new PageArray(); foreach ($kids as $k) $interests->import($k->interests); $iTotal = count($interests); foreach ($interests as $i) $i->useCount = count($pages->find("interests=$i")); echo "<h3>Interests ($iTotal)</h3>"; echo '<ul>'; foreach ($interests->sort("-useCount") as $i) { echo "<li><a href='interest/$i->name'>$i->title</a> ($i->useCount)</li>"; } echo '</ul>';
  17. ok i fixed the code for the 2nd one adding the missing close ) however the first example should work, there can't be duplicate pages in the PageArray(), so you must be doing something funky if you are getting the same 'interest' tag. Are you positive you don't have duplicates in your system - are the interests all stored under the same parent? You should check; if you do have duplicate interest titles in your system PW can't remove the duplicates from the array because it is keyed to the page ID. you could sort the array by title and then check to see if the previous item has the same title and then skip it, that's an easy way to exclude duplicates.
  18. you have some options... <?php // version using PageArray(); $kids = $pages->find("template=poi, has_parent=$page"); $interests = new PageArray(); foreach ($kids as $k) $interests->import($k->interests); echo '<ul>'; foreach ($interests as $i) { echo "<li><a href='interest/$i->name'>$i->title</a></li>"; } echo '</ul>'; // or find all interests, cycle through but ignore those that don't apply to this page $interests = $pages->find("template=interest"); echo '<ul>'; foreach ($interests as $i) { if(!count($pages->find("template=poi, has_parent=$page, interests=$i"))) continue; echo "<li><a href='interest/$i->name'>$i->title</a></li>"; } echo '</ul>'; ?> wow, 3 replies!
  19. isnot would be expressed by the false of is if(!$page->is("template=foo|bar"))
  20. i think the referenced functions are simply conditional and foreach statements that are crafted to get a needed output. If you are doing a mega menu, you just need to analyze the structure/pattern and try and see if there is some way to foreach through your page tree or menu tree and get the output you want.
  21. how are you getting that partial=true, i can't see how the render method takes any arguments, at least not here: http://cheatsheet.processwire.com/page/built-in-methods-reference/page-render/ perhaps you could use wireRenderFile, or wireIncludeFile
  22. having some trouble with CC, i'm supplying an array, like this: $mail->cc($array); and i know my array is good, and CC works for 1 CC (I have $mail->sendSingle(true); ) but it will only CC the last member of the array, no matter which array type i input. ...... OK - forget this, i just updated to the latest version and this was fixed...
  23. Can you post your page tree structure, and then how you want that to translate into the menu, this way a function can be written to get the menu to output according to that structure, but with the required markup.
  24. Perhaps a quick way to troubleshoot would be to look at a formbuilder form, an example of which is the showcase submission form (categories field). Looking at the source code of that might possibly reveal any dependencies; Also that may be running in an iframe, which is the default embed method for FB.
×
×
  • Create New...