-
Posts
2,780 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Macrura
-
yes, good point... would be keen to see it. Mostly though, i never seem to be able to use stock systems, because the business logic is hard to encapsulate into one system, which is why if you build this with PW backend, then you are really tailoring it for specific use; I also say this because i just alighted from a 200+ hr asp.net project (where my part was only a fraction of the total labor) in building a custom app, and never a day went by when i observed how so many of the things we needed to constantly build and rebuild and fix could have been handled simply by pw admin;
-
@FrancisChung, perhaps I'm misunderstanding this, but I think you are saying they are pasting markup into an RTE? That could never work under any circumstances, because RTE means rich text, not markup. If they want to paste in markup, they would have to first click the code view button.
- 10 replies
-
- 1
-
-
- HTML Entity
- HTML
-
(and 2 more)
Tagged with:
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
Macrura replied to kongondo's topic in Modules/Plugins
In my case i only have 1 field and then my code checks for which template it's on, then outputs various buttons and messages; the buttons themselves just link to templates that read the url parameters and run some process. Eventually i'll probably have a generic module to process the buttons.. i think I'm going to be using this a lot! -
Module Module: RuntimeMarkup Fieldtype & Inputfield
Macrura replied to kongondo's topic in Modules/Plugins
This is such a great module; recently I used it to create custom action buttons on my calendar/futuremail app; Send or preview the email message for the future mail: send or preview a calendar event, which is typed by a chosen template (e.g. event, lesson reminder, etc.) -
beginnerquestion on performance with a textformatter
Macrura replied to mr-fan's topic in Module/Plugin Development
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 | +---------+----------+- 5 replies
-
- textformatter
- beginner
-
(and 1 more)
Tagged with:
-
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.
-
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.
-
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.
-
it's just a lot better.
-
ckeditor - Remove wrapping <p> from <img> in source code
Macrura replied to CodeCoffeeCode's topic in Modules/Plugins
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; -
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
-
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...
-
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);
-
portable web server. with PW... bitnami?
- 30 replies
-
- deployment
- tools
-
(and 1 more)
Tagged with:
-
no problem.. have you echo'd what PW is generating for your $page->Header_select->contactAddress ?
-
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.
-
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...)
-
Remove duplicates in a foreach loop (but count them)
Macrura replied to Reid Bramblett's topic in Getting Started
cool -
We could drink Club Mate instead of coffee, for this 1 day
-
Remove duplicates in a foreach loop (but count them)
Macrura replied to Reid Bramblett's topic in Getting Started
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>'; -
Remove duplicates in a foreach loop (but count them)
Macrura replied to Reid Bramblett's topic in Getting Started
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. -
Remove duplicates in a foreach loop (but count them)
Macrura replied to Reid Bramblett's topic in Getting Started
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! -
isnot would be expressed by the false of is if(!$page->is("template=foo|bar"))
-
Kraken: Drop Jumbo with Astro Navbar. Conversion to ProcessWire
Macrura replied to Christophe's topic in General Support
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.