-
Posts
2,769 -
Joined
-
Last visited
-
Days Won
31
Everything posted by Martijn Geerts
-
I started with CMSses with MODX revolution and there you had that 'pesky' template language. Sometimes you have to do [[]], then you've to do [{}] and some need a * and others need the exclamation mark. Then on every found info page I had to think, is this for evolution or revolution, is this a snippet or a chunk. And if you want to have a simple if-statement you needed to start a snippet and a chunk as template or had to find plugins who install all kind of other snippets, plug-ins and other 'garbage' to do a simple comparison. If you can handle all that noize while thinking on building a site, you already can code. ( Maybe you don't realize that now ). There are less exceptions in PHP then there is in the MODX language. You can find documentation every where. You just have to start with the basic things. Actually, ProcessWire is the perfect environment to start learning PHP. (could be a little off with the MODX tpl language, I already forgot how to use it)
- 9 replies
-
- 10
-
-
Sorry Hari, didn't read well..(all the time:-)) Does this solve: $pages->find("parent.template=category, parent.status!=unpublished|hidden, template=articles");
-
$pages->find("parent.template=category, template=articles");
-
That design does make sense. Every PW developer should know that, it's mentioned by you ryan and a lot of developers around the forum here. But it doesn't pickup changes, if started with a value... ( still weird ) (but we have a work around here)
-
If you start with the value of 1, you unchecked it and saved, the value should be 0, and not unchanged ( If you start with the default of 0, it all works ) Never the less, after loads of post, a bug report, restarting computers, trying on different installs etc etc, I wil never forget, I will do checkboxes the way in the post above. Thanks all...
-
I confirm that your code works, never the less, I consider the issue as a bug. // this works $field = $this->modules->get('InputfieldCheckbox'); $field->attr('name', 'fname'); $field->attr('autocheck', 1); $field->attr('uncheckedValue', 0); $field->attr('checkedValue', 1); $field->attr('value', $this->fname);
-
@Soma, same issue with your code: // Pre-populate the data // this doesn't work, NOT saved to fields.data (db) public function __construct() { $this->set('fname', 1); } // this works, nicely saved to fields.data (db) public function __construct() { $this->set('fname', 0); }
-
Pete, can you do something about the state "best answer", "solved" is better I guess if the press the button solved ,
-
I've found the issue If you predefine a default value of (int) 1 the value is not saved to the database. ( fields.data ) If you predefine a value of (int) 0, it all works as expected. Bug is reported to github.
-
date is a field.
-
Please use Matrix Fieldtype & Inputfield Or the ProFields. FieldtypeJson (module) Álpha I've been busy last 2 weeks with a new fieldtype. I needed a fieldtype that generates JSON strings from CSV (excel data). I needed a way to handle a variable amount of columns & needed a way to manage that data. Wanze & Kongondo already worked on a excel crud module with the excellent Excel-like data grid editor Handsontable and I loved that piece of software. Thank you guys. Handsontable is used in the Inputfield part. What the Inputfield does does: If there's no data in the field, the Inputfield shows you a textarea. You could copy 'n past in CSV text in that field. When you save the field, all data is processed. Processing means: Slice till an x amount of data rows. If minimum amount of columns is not reached, pad the columns till the amount you've specified in the settings If the data contains to much columns, slice the redundant amount of columns. Every data left, is trimmed and sanitized Every numbered string will be converted to integers Saved in 2 formats: 1) json and 2) cvs Server side there's a lot of processing needed to perform all this, that is the reason to set a low amount of data rows. On The Inputfield side, the JSON is generated by Handsontable. So this feels a bit dirty. (Server side it does do all the steps in the above list.) For now it's called FieldtypeJson, but i'm not to keen on this name. Output How to output in your template: $page->fieldname // (string) the table markup $page->fieldname->json // (string) JSON string $page->fieldname->csv // (string) CSV string $page->fieldname->rows // (int) number of rows, not really usefull, but needed internally $page->fieldname->columns // (int) number of columns, not really usefull, but needed internally When to use: If you need a small set tabular json data, and you don't know how many columns it has. If you want to have render tables quicky in your site. When not to use: Store very large sets of query -able data. If you have to rely rely on the data. ( all json is stored in a subfield, and the same for csv ) API Side (JSON): // Json string $json = '[["First Name","Last Name","Company Name","Address","City","State","Post","Phone","Email"],["Rebbecca","Didio","Brandt, Jonathan F Esq","171 E 24th St","Leith","TA","7315","03-8174-9123","rebbecca.didio@didio.com.au"],["Stevie","Hallo","Landrum Temporary Services","22222 Acoma St","Proston","QL","4613","07-9997-3366","stevie.hallo@hotmail.com"],["Mariko","Stayer","Inabinet, Macre Esq","534 Schoenborn St #51","Hamel","WA","6215","08-5558-9019","mariko_stayer@hotmail.com"]]'; $page->of(false); // Turn OutputFormatting of $page->fieldname->json = $json; $page->save(); $page->of(true); API Side (CSV): // CSV string $csv = '"First Name","Last Name","Company Name",Address,City,State,Post,Phone,Email Rebbecca,Didio,"Brandt, Jonathan F Esq","171 E 24th St",Leith,TA,7315,03-8174-9123,rebbecca.didio@didio.com.au Stevie,Hallo,"Landrum Temporary Services","22222 Acoma St",Proston,QL,4613,07-9997-3366,stevie.hallo@hotmail.com Mariko,Stayer,"Inabinet, Macre Esq","534 Schoenborn St #51",Hamel,WA,6215,08-5558-9019,mariko_stayer@hotmail.com'; $page->of(false); // Turn OutputFormatting of $page->fieldname->csv = $csv; $page->save(); $page->of(true); After save, all other subfield are updated. So saving JSON will update CSV and the rows and the columns. And saving CSV will update JSON and the rows and the columns. Saving direct to the fieldname, or saving to both json and csv or saving to the rows & columns wil thow a wireException(). Download: source on github Warning: This Fieldtype is Álpha, don't use it in live projects empty field: paste data: imported data: manage data: settings:
- 21 replies
-
- 18
-
-
Damn, Horst ! Very very cool...
-
Empty field in one language displays default language
Martijn Geerts replied to joe_ma's topic in Multi-Language Support
You could use strlen() I think -
lol, If you remove data with javascript, you should not search why PHP is not outputting
-
The issue continues, on my work machine (same code as the fixed code from yesterday, there must be something with PHP ) pphff... I'll replace the checkboxes with radios.... just to be sure.. at home php 5.5, here php 5.4, PW: 2.4.1
-
Yes they do: as time elapses, next id's become higher
-
Call to a member function first() on a non-object
Martijn Geerts replied to bwakad's topic in API & Templates
->render() is just a methode in a class (function), and output mostly the expected thing/string. The name render is called render cause thats a good english word for rendering. You're free to use render() as methode name while developing. You could swop the name render for bwaked, if you think it's more appropriate for the thing you're writing or want to output. And if your render methode wil throw an exception, you'll get a different look -
I love the autocheck, what car you have, can we check it out ? And indeed: public function __construct()
-
-
Big thanks for all your time, Soma, Adrian, Willy Kongondo you guys are awesome....
-
Restarted my computer.... looks like it's working now... Could it be some kind of cache/php issue... totally lost Oké, I hope we all forget this....
-
Will do Soma, ( Would have posted this already if I don't have this stupid issue over here.... ) Adrian's example worked, until I changed the name again. makes me mad....
-
You've the wrong settings in your mind Soma, it's not the settings from ConfigurableModules which are static, these ( Input field settings are not. )
-
You're the best Adrian. Soma pointed to the real bug... now I have to find out where it goes wrong (your code works) It's all kinda weird, it not the first time I use Checkboxes...
-
Can you settle with type of text, and use a pattern to match your needs.