-
Posts
7,479 -
Joined
-
Last visited
-
Days Won
146
Everything posted by kongondo
-
Recommended module / solution for displaying syntax highlighted code?
kongondo replied to saml's topic in General Support
You can still use your rich text editor, weaving in and out of source code mode... https://processwire.com/talk/topic/4187-formatting-a-code-block/. See posts about pbckcode plugin.- 4 replies
-
- 2
-
- code
- syntax-highlighting
-
(and 1 more)
Tagged with:
-
Hermoso!
-
Find most efficient solution for storing multiple values in a field
kongondo replied to gebeer's topic in General Support
Nice! This was a learning experience for me too . Would love to see the final code/implementation (if possible). Or is it the one above? -
Yes. That and Fancybox (I don't think it has been retired yet). Disregard my comment. I misread the question
-
Aren't you able to use PW's inbuilt modal?
-
Find most efficient solution for storing multiple values in a field
kongondo replied to gebeer's topic in General Support
Actually if you look at the code in Timestamp.php, lines 40-47, that is where the conversation from string to integer happens so you don't have to do this in your foreach; Providing a date string is enough . if($key == 'date') { // convert date string to unix timestamp if($value && !ctype_digit("$value")) $value = strtotime($value); // sanitized date value is always an integer $value = (int) $value; } See also the comment in FieldtypeTimestamps.module lines 140-1 Also never got the errors you were getting. But I suppose your implementation of the code is different so I may be way off here... Btw, about your earlier questions on how stuff was getting deleted in the backend? The module is using trackChanges. You can read more here about the method. Edit: Aaah, I think I now see why you were getting that PHP notice. As pointed out in the SO link you gave, date() expects the second parameter to be an integer. In the case of InputfieldTimestamps.module, it's getting its values from the database. Those values were already saved as integers so no need for strtotime at that point. In your case, your values are coming from your frontend form as strings so they needed to be parsed into timestamps. At least I think this is what was happening. Anyway, you sorted it out but just thought to clarify this. Or maybe, I am not getting what's going on....I am having one of those slow days...again...sigh... -
Actually FieldtypeComments already has built in support for Gravatar. Never tried it though and don't know how to use it. I have looked at the code but can't figure this out. I also don't have a Gravatar account so can't test anyway. Anybody knows how to use this and willing to help us out with this? Hopefully Ryan will also see this. Thanks.
-
policy on php short tags in PW modules / docs?
kongondo replied to jordanlev's topic in Getting Started
Not a direct response to your question but I have never liked the PHP short tags (just a matter of preference). Even on personal sites where I am sure short tags feature is enabled, I never use them. I don't think there is a general consensus about their use (or not) in modules but I would urge all module developers to stay clear of them just to ensure compatibility.. -
ProcessWire should have detected and given you a message about deleting the old one in your sites folder. Did you see those instructions on updating PW to 2.5? You are better off uninstalling your 'old' CKEditor (the one in your /site/modules/). The one in wire (the default that now ships with PW) will work just fine.
-
Looking at PocketGrid's styles, I see no code that is doing what you describe. Are you sure this is not coming from your other styles, directly or inherited? What is Chrome developer/Firebug telling you?
-
How to hook into template rendering to pass it variables?
kongondo replied to jordanlev's topic in Getting Started
@Jordan, Some useful links: https://github.com/ryancramerdesign/ProcessHello http://wiki.processwire.com/index.php/Module_Creation http://processwire.com/api/modules/ https://processwire.com/talk/topic/741-a-guideline-for-module-naming/?p=6267 https://processwire.com/talk/topic/2394-how-to-present-your-module/ https://processwire.com/talk/topic/1313-modules-process-and-the-difference/ -
How to hook into template rendering to pass it variables?
kongondo replied to jordanlev's topic in Getting Started
Jordan, I am not sure whether this would help: https://processwire.com/talk/topic/4647-best-hook-for-replacing-page-rendering/?p=45968 but I am failing to understand how a Process Module (modules that run in the backend/admin) has anything to do with something that will be rendered in the front-end (basically a page's template)... -
Matrix/table built with children of two pages
kongondo replied to charger's topic in General Support
Ah, I understood it in the English sense - low-level means basic and high-level means advanced. So 'deep inside the core system' means high . OK, I'll try get some time soon to expound on what I said in the post above yours -
@RJay https://processwire.com/talk/topic/2387-the-structure-of-fields-and-templates/?p=22762
-
@LostKobrakai: I think you meant "the principle of having a table for each field is one of the ...."
-
Matrix/table built with children of two pages
kongondo replied to charger's topic in General Support
Hi Charger, I thought you'd given up on this given your absence I'd started to work on something (it was actually working, i.e. dynamically adding rows and columns - except for saving to the DB) but then I hit a few snags and was wondering whether this wouldn't be best achieved by a dedicated ProcessModule or an extended PageTable....If you are about later, I could try and explain... ps: low-level or high-level?? -
Find most efficient solution for storing multiple values in a field
kongondo replied to gebeer's topic in General Support
@Gerhard, Note I am also new to Fieldtypes so, you may want to thoroughly test/validate, etc the attached. I have customised (mainly just commenting out stuff actually ) the FieldtypeEvents to only save timestamps (1 column table). As was native to FieldtypeEvents, each timestamp on a page is saved in its own row in the DB. Although I have also included the inputfield, you have several options: disable its page visibility in the template field visibility settings; disassociate it from the FieldtypeTimestamps Class and not install it or install it and use it to also have a visual view of the timestamps. You also get the nice jquery 'delete' or 'delete all' timestamps (events). If you don't want to install the Inputfield, you will also have to comment out/remove the method getInputfield() from FieldtypeTimestamps.module. Adding timestamps via API As shown here adding items to the Fieldtype via the API is quite easy (similar code exists in the the ___processInput() method in the InputfieldEvents (in the attached this is InputfieldTimestamps). $times = array('1521884800', '1721884800', '1571884800');//these can also be other valid PHP date/times, e.g. 20-10-2007 $page->of(false); foreach($times as $t) { $timestamp = new Timestamp();//this is the Class Timestamp found in Timestamp.php. Included via FieldtypeTimestamps. $timestamp->date = $t; // note stored in column 'data' in the db of the Field $page->timestamps->add($timestamp); } $page->save(); $page->of(true); To output timestamps using API foreach ($page->timestamps as $t) { echo "<p>Date: $t->date</p>"; } Finding items via API See Ryan's example here; I didn't check if it needs tweaking. Other things to note You can change the Inputfield to show timestamps rather than the date - InputfieldTimestamps.module lines #32-33 Currently the time format is hard coded as d-m-Y in Timestamp.php line #9 Left the commented out stuff in there...you can clean them out if all goes OK FieldTypeTimestamps.zip -
accept terms before download - module for that?
kongondo replied to douglas81's topic in General Support
Here's a couple of thoughts... https://processwire.com/talk/topic/4602-flexible-downloads-using-pages/ https://processwire.com/talk/topic/5177-download-file-statistics/ https://processwire.com/talk/topic/1323-downloading-file-after-form-submission/ https://processwire.com/talk/topic/5292-proctecting-files-from-non-logged-in-users/ -
This works for me: $x = $pages->find("template=mytemplate, $myfield=''");
- 1 reply
-
- 1
-
Btw, just realised that with 'Table' added to the CKEditor Toolbar, you don't need to add any other Table Markup to the Extra Allowed Content. It will work just fine...
-
Here's how it worked for me in CKEditor (in case you persist on this route - but I would go for Hanna Code as Adrian suggested. As usual, the "culprit" is our friend HTML Purifier (read from here up to and including Ryan's comment here about its pros and cons before deciding whether to implement #5 below!) For iframes, the Extra allowed content seems to have no effect - btw, the correct syntax here is for example, div(*) not div[*] Add 'Iframe' (note the spelling) to your CKEditor Toolbar Leave ACF on No need to switch the field's "Content Type" from "Markup/HTML" to "Unknown" Turn HTML Purifier off (gasp! ) Enjoy your embedded video
-
To answer my question. I am guessing you added 'Table' to the CKEditor Toolbar. You are then inserting tables using the Table icon, correct? I have tested this too and it works fine. I can right click and delete the table and it disappears; it doesn't come back after save . I have also double checked and there are no <p>s in the <td>s. The only way to get <p>s inside the <td> is if you type and press enter to create a new line within the <td> . I think that's what your client is doing? Unrelated, but good to know that using the tab key to move within cells works fine
-
Find most efficient solution for storing multiple values in a field
kongondo replied to gebeer's topic in General Support
See the two posts above yours -
Find most efficient solution for storing multiple values in a field
kongondo replied to gebeer's topic in General Support
Picking up on sforsman's idea, have a look at Ryan's Event Fieldtype, especially how he stores timestamps. Pretty straightforward: https://processwire.com/talk/topic/5040-events-fieldtype-inputfield-how-to-make-a-table-fieldtypeinputfield/ -
That's strange. How is the table being created? Using source view? I doubt the client knows HTML though . Anyway, in my case, I see no <p>'s inside <li> nor in <td>s..