-
Posts
7,479 -
Joined
-
Last visited
-
Days Won
146
Everything posted by kongondo
-
Posting to a php folder without creating a page
kongondo replied to nickngqs's topic in General Support
You cannot post to nothing . You have to post your client-request to something server-side to handle that request. That something can be a module page or a 'normal' (hidden, in admin, etc) page. A URL Segment alone won't work. The name gives it away. Segment of a URL. A URL points somewhere. In ProcessWire, it points to a page. So, yes, you will need a page somewhere in the system. -
To add 3 url-link field to same template
kongondo replied to franciccio-ITALIANO's topic in Getting Started
Yes...unless am misunderstanding you. If you have a repeater with these 3 fields: Email (email) Phone (text) Address (text). When editing the page, you can have these repeated as many times as you want, e.g. Email (email) Phone (text) Address (text) Email (email) Phone (text) Address (text) Email (email) Phone (text) Address (text) Email (email) Phone (text) Address (text) Is that what you meant? -
Yeah. MIT license is pretty permissive.
-
Hi @huhabab, Welcome to the forums. Glad you find the module useful. Yes, they are. What events are you missing? Have you seen the ones listed in the docs under Callback Options ? I have tested a couple and they work as advertised. The Callbacks section of the API Docs is also a good read in this regard. Maybe you can show us some code?
-
I'm not sure I follow 100% so, I could be way off. I'm unsure which of the following 'understandings' apply . My understanding #1: You don't want to use Commas Commas, Pipes, Equals signs, etc. all have their specific uses in ProcessWire's selector engine. Commas represent AND operator and Pipes OR operator. So, if you need ALL conditions to match, you have no choice but to use the AND operator, i.e. the Comma. I'm curious, why don't you want the commas? My understanding #2: You don't want to use a Filter (aka, want one selector) Do you mean a way to find only the matching events in one find rather than filtering them down using filter() [I'm probably way, way off here, since you are building a filtering system ]
-
What @BitPoet said. In other words, PHP is fast, MySQL is fast. So, there is no guarantee that you will have only 1 page created per second (your date), or even per microsecond! That leaves you with uniqueness dependent only on the customer ID ($client->CustomerCode). If you can guarantee that customer IDs are unique and that they only appear once per data set, (your JSON array) then you would be fine. The fact that you are getting a SQL error tells us that either your customer IDs are not unique and/or one customer ID is appearing more than once in your data set (i.e., it may be uniqe to the customer, but not the data set). If the database says so, then it must be so . Let me illustrate (non-unique customer ID and/or replicated customer ID): $clientCustomerCode = 12345;// replicating repeated use of customer ID $p = $pages->get(1722); for ($i=0; $i < 30; $i++) { // Create new page $new = new Page(); // Create unique hash {no guarantee this will be unique if same customer ID used} $unique = md5(date("Y-m-d H:i:s") . "-" . $clientCustomerCode); // even these (microseconds) do not guarantee uniqueness throughout #$unique = round(microtime(true) * 1000) . "-". $clientCustomerCode; #$unique = microtime(true) . "-". $clientCustomerCode; #$unique = microtime() . "-". $clientCustomerCode; echo $i . ': ' . $unique . '<br>';// display 'uniqueness'; you should see duplicates here // Set some variables for the new page //$new->setOutputFormatting(false);// not needed for a new page (I think) $new->template = "basic-page"; $new->parent = $p; // Create hash $new->title = "Title " . rand(5,15);// just for testing $new->name = $unique;// not really unique! // Save the page #$new->save();// you'll get PDO error here within a second } Using the above code, you'll be hit by the duplicate entry violation error within a second...
-
[SOLVED] Call Custom Field Containing iFrame Code
kongondo replied to ridgedale's topic in General Support
Seems like you are using the forum's inbuilt search function? It's not the best. Try google, e.g. iframe site:processwire.com/talk/ OR this CSE (the one in my signature) OR...there are other similar ones (including a plugin) in the forums. Can't find it now . Are the URLs dynamic or set some place? You could save your editors some copying and pasting by having those ready-made and selectable in some inputfield, e.g. Fieldtype Options. I don't know you setup so my suggestion might not be appropriate. Just a thought. -
Trying to get a module's InputfieldSelectMultiple options
kongondo replied to Jo J's topic in API & Templates
Hmm, maybe Fieldtype Options, although it stores the labels separately. Alternatively, you can have your value be a 'label|value' combo. Or save the labels to some file and read that using PHP. Just random ideas... -
Trying to get a module's InputfieldSelectMultiple options
kongondo replied to Jo J's topic in API & Templates
It's hard to tell without knowing what type of module it is you installed. Is it a module you wrote? Either way, 'labels' of inputs (your Content 1, 2 and 3) are not themselves stored. It is the values that are stored. If your module is a Process Module, selected values will be stored in the module's config. You can retrieve them using getModuleConfigInputfields(). There is a newer method that does the same thing but I cannot remember its name at the moment. The methods will return an array, $data, whose indexes are your properties, e.g. $data['fieldA']. In the database, these are stored in the modules table, in the row for your module, in its data column as a JSON string. If your module is a Fieldtype, the name of the input is a property of your $field. So, you access the value as $field->fieldA. As mentioned earlier, labels are build on the fly as per the options you pass the module. -
[SOLVED] Call Custom Field Containing iFrame Code
kongondo replied to ridgedale's topic in General Support
Most likely CKEditor eating up your iframe code if you've not configured (Input Tab) it to allow such code. If that's the case: -
Can anyone tell me the difference between the following pieces of code
kongondo replied to SamC's topic in General Support
I have checked. The WireArrays are identical as well. Each with the same 4 items. -
Can anyone tell me the difference between the following pieces of code
kongondo replied to SamC's topic in General Support
Thanks for testing @adrian! The code is from the OP. However, the OP, @SamC, is getting different results with the very same code. Similar to yours, here's my Tracy console output: The output is identical -
Can anyone tell me the difference between the following pieces of code
kongondo replied to SamC's topic in General Support
Hmm. Then I must be going mad. Using the original code by @SamC, (even together/at the same time), I get identical output! Could someone please try the following and let me know if you get different/same output? Even if I comment out the 2nd $pages->get('/'), it makes no difference // code 1 $root = $pages->get("/"); $children = $root->and($root->children); echo $children . '<br><hr>';// outputs >>> 1|1001|1005|1137 // code 2 $root = $pages->get("/"); $children = $root->children; $children->prepend($root); echo $children . '<br>';// outputs >>> 1|1001|1005|1137 exit; ProcessWire 3.0.85, home.php (at the very top, exit after code) -
Alternatively... echo "<div id='options'>" . $page->getUnformatted('options')->title . "</div>"; // the <span></span> render correctly as HTML (unescaped) https://processwire.com/api/ref/page/get-unformatted/
-
Can anyone tell me the difference between the following pieces of code
kongondo replied to SamC's topic in General Support
The issue is that for Sam, in the first code, "Home" appears twice, for some reason. I wasn't able to replicate that. I have a strong feeling that some other code is contributing to that anomaly. -
@LAPS. Moderator note: I moved your post with the bug report about the new module to its current support home. It makes more sense to discuss the module in one place.
-
How to "pick" pages as in this forum for @users?
kongondo replied to LAPS's topic in General Support
Either create a dedicated, hidden, page or a custom ProcessModule to handle the request. -
How to "pick" pages as in this forum for @users?
kongondo replied to LAPS's topic in General Support
I don't think there's one. Google comes up with some interesting examples though (searching for CKEditor autocomplete or CKEditor mentions). Maybe some of the below could be a starting point? https://ckeditor.com/old//forums/CKEditor-3.x/Get-current-word-and-display-auto-complete-options https://stackoverflow.com/questions/28377886/autocomplete-lists-in-ckeditor https://web.liferay.com/fr/web/jose.balsas/blog/-/blogs/new-feature-for-liferay-7-autocomplete-lists-in-ckeditor https://github.com/liferay/liferay-portal/tree/00f84a16ac1740dc7c2f5fd8efa2fa3c5b4a8b55/modules/frontend/frontend-editor/frontend-editor-ckeditor-web/src/main/resources/META-INF/resources/_diffs/plugins/autocomplete http://navalgandhi1989.github.io/ckeditor-autocomplete-suggestions-plugin/ (a ready made plugin; demo didn't work for me) https://www.sencha.com/forum/showthread.php?291551-How-do-I-implement-autocomplete-as-I-type-in-a-textarea Rather than querying the server every time via Ajax to get suggestions, you could cache the suggestions client-side (in a hidden HTML element, local storage or JS config) -
Oops! My bad.
- 46 replies
-
- blog post
- change path formatting
-
(and 1 more)
Tagged with:
-
Hey @ridgedale. I am the author of the Blog module. I might be able to offer a couple of suggestions (1. Manually creating the /year/month/ folders; I have tested and it works {see screen below}; 2. Hooking into Page path.). Briefly ask your question again in the module's support forum (will help others get the context) and I'll walk you through the suggestions.
- 46 replies
-
- blog post
- change path formatting
-
(and 1 more)
Tagged with:
-
Hehe! You made my evening Ryan . Sorry for your troubles but it's good that you are seeing the funny side of it and making the most of the situation. I miss this side of Mr Cramer! . Perhaps it's a good thing that once in a while we let the code rest and let our hair down (pun not intended!). Hope you get your furnace and office sorted soon.
-
How to state separately a PW hook that uses the 'use' PHP construct?
kongondo replied to LAPS's topic in Getting Started
Did this not work? It should. wire()->addHookBefore('Pages::save', null, 'hookFunction');// grab function hookFunction(HookEvent $event) { // do your stuff } http://processwire.com/api/hooks/ -
Can anyone tell me the difference between the following pieces of code
kongondo replied to SamC's topic in General Support
Nice find! . -
Can anyone tell me the difference between the following pieces of code
kongondo replied to SamC's topic in General Support
Because you are calling both code at the same time . Comment out the first (the one using and() AND it will work). An object is already in memory and PHP has a reference to it, so the items are added to the original object....or something like that...I am a bit knackered, sorry, can't give a better explanation . -
Can anyone tell me the difference between the following pieces of code
kongondo replied to SamC's topic in General Support
I've tested your code and the outputs are identical. Must be something else you are doing? Why? In the first (using and()), you are adding children to the existing item (Home). In the second, you get the children and prepend their root (Home) to them. Side note: What I don't understand is why and() has worked with the single page object ($root). I thought (as per docs) it should only work with WireArrays (also PageArrays). $root is a Page not a PageArray, or am I missing something?