-
Posts
365 -
Joined
-
Last visited
-
Days Won
5
Everything posted by Raymond Geerts
-
Should'nt the selector be somthing like this? $p = $pages->find("template=product,field=prod_calc_a1|prod_calc_a2"); And then foreach ($p as $i) { echo "{$i->id} - {$i->field}<br />"; } But i'm not entirely sure what you want to achieve
-
I'm not sure if this is the right place to put this or if this could be seen as a feature request. Maybe it is possible to solve it with a Process module instead. It would be nice to be able to query the FieldtypePage and filter it on a timestamp. /** * Return the database schema in predefined format * */ public function getDatabaseSchema(Field $field) { $schema = parent::getDatabaseSchema($field); $schema['data'] = 'int NOT NULL'; $schema['keys']['data'] = 'KEY data (data, pages_id, sort)'; return $schema; } The extra column i'm thinking about would be named 'added' and would work the same as the 'modified' field used in pages for example. $schema['added'] = 'timestamp NOT NULL default CURRENT_TIMESTAMP'; In this way every time you add a Page to a InputfieldPage the timestamp is automaticly set to the current date and time and saved to the database. With this extra column it should be possible to get pages added to a InputfieldPage field on a certain date and time, or after/before a certain date and time. For example if you have a friends, incomming friends, outgoing friends list with Users, with this extra field it will become possible to show new added friends (or incomming request) after last login. It would be a small addition to the already available FieldtypePage, does'nt take much space in the database but gives some extra benefits for the usage. I have tried to Make two custom modules for this, namely FieldtypePageTimestamp and InputfieldPageTimestamp but somehow it wouldnt display any variables (name,title,etc..) of the pages anymore. Could be because these are core and are completely interwoven, not sure. I have thought about a custom process module but that would just bring a lot of overhead of data and processing with it. Atleast in the way i was thinking it should have 3 extra fields, for page id, linked page id and timestamp. So that might not be the way to go.
-
Could be the WYSIWYG editor is corrupted, i havent installed the SkyscrapersProfile but i'm guessing this is the default editor TinyMCE. Do you get any javascript errors? You might want to check if all files where uploaded correctly to the server. In case there are missing files on the server, this happend to me too in the past. A way to solve this is to upload the entire ZIP in once and extract it on the server (if your hosting supports this feature)
-
Figured it out $field->attr('value', is_array($data['subscriber_number']) ? $data['subscriber_number'] : array());
-
Any example on how this work with a ConfigurableModule when using InputfieldCheckboxes (the multiple checkboxes field) I have this code, but got no idea how to set the values checked when they get saved, also couldnt find any examples on the forum so far. $field = wire('modules')->get('InputfieldCheckboxes'); $field->name = 'subscriber_number'; $field->label = 'Subscriber number'; $field->addOption('visable', 'Visable'); $field->addOption('required', 'Required'); $field->addOption('editable', 'Editable'); $field->columnWidth = 50; $fieldset->append($field); In the database it saves the following json string when all values are checked when saving the module: {"subscriber_number":["visable","required","editable"]}
-
Nice that you finished it. Looking good, will give it a try.
-
I know i can set signed/unsinged and INT, TINYINT, BIGINT in the database itself, witch will probably do fine. But would be nice to be able to set these on UI level too
-
I think that will give weird sortin, sorting text most probably will do this: 0 10 107 5 600346 70 instead of sort int will give 0 5 10 70 107 600346
-
Anyone knows what the status of this is? Just wondering because i wanted to add a int 3963252157 to a integer field, but because its not unsigned the number is to large and triggers a "out of range" error. Could be i missed it but i couldnt find the settings of the integer field, or is there perhaps a different fieldtype i need to install? Running PW 2.4.1 (latest dev branche)
-
You can use selectors as you would use to retrieve pages. Only in this case you need to use the parameters that the current field contains. You can always do a var_dump on a certain object to see what parameters and variables it holds. echo "<pre>"; $key = 1; echo "1) ". $fields->get($key)->name ."\n"; // key = 1 echo "2) ". $fields->get("id=1")->name ."\n"; // selector: id=1 echo "3) ". $fields->get("name=title")->label ."\n"; // selector: name=title echo "4) ". $fields->get("name=title")->type ."\n";// selector: name=title $field = $fields->get(1); $field->set("label","Enter a title"); // key: label, value: Enter a title echo "5) ". $fields->get("name=title")->label ."\n";// selector: name=title var_dump($fields->get("id=1")); 1) title 2) title 3) Title 4) FieldtypePageTitle 5) Enter a title object(Field)[159] protected 'settings' => array (size=5) 'id' => int 1 'type' => object(FieldtypePageTitle)[133] private 'allowTextFormatters' (FieldtypeText) => boolean true protected 'data' => array (size=0) empty protected 'useFuel' => boolean true private 'className' (Wire) => string 'FieldtypePageTitle' (length=18) protected 'localHooks' => array (size=0) empty protected 'trackChanges' => boolean false private 'changes' (Wire) => array (size=0) empty 'flags' => int 13 'name' => string 'title' (length=5) 'label' => string 'Title' (length=5) protected 'prevTable' => null protected 'prevFieldtype' => null protected 'data' => array (size=4) 'required' => int 1 'textformatters' => array (size=1) 0 => string 'TextformatterEntities' (length=21) 'size' => int 0 'maxlength' => int 255 protected 'useFuel' => boolean true private 'className' (Wire) => string '' (length=0) protected 'localHooks' => array (size=0) empty protected 'trackChanges' => boolean true private 'changes' (Wire) => array (size=0) empty (string) $field; see type casting -> www.php.net/manual/en/language.types.type-juggling.php
-
From here i can not see what kind of child pages Organigramme has, but in general when you want sorting for the children you need to set it in the parent template. So when you need different sorting you need to use an other template. You could try the following setup where you have the folowing templates: (You might be able to do it with less then these templates, but its just to give an idea) activites-group -> children sorted by: none activites -> children sorted by: date field activite -> children sorted by: manual drag&drop activite-detail -> children sorted by: none activite-detail-child -> children sorted by: none With the page tree used from your screenshot: Activités Activités à venir Activités récentes Le vieillissement dans tous ses états Montréal en rose Nous joindre Pré-programmation Organigramme Child 1 Child 2 Child 3 Informations pratiques Appel à bénévoles Archives Archive-activité 1 Archive-activité 2 Archive-activité 3
-
Ah you're right WillyC, altough this should work fine too $input->urlSegment(1); $input->urlSegment(2); $input->urlSegment(3); While these below are wrong $input->urlSegment[1]; $input->urlSegment[2]; $input->urlSegment[3];
-
As it might be obvious, i'll just ask it anyway, did you put a number from 1 to 3 in your code in the place where the n is? The character n represents a number. echo $input->urlSegment(1); Also, you must have URL segments turned on for the related template, and last but not least you must have a urlSegment in your URL. Lets say your page with a template that has urlSegments turned on is located at: http://yourdomain.com/foo/ Then if you visit it at the following URL the $input->urlSegment(1) will print "bar" http://yourdomain.com/foo/bar/ Edit: replaced [1] with (1)
-
TextLanguage field problem
Raymond Geerts replied to Raymond Geerts's topic in Module/Plugin Development
Creating a TextareaLanguage field works perfectly, the problem occurs as soon as i create a TextLanguage field. I thought MySQL has a limit on columns of 1024 so i'm guessing its a hard coded limit set somewhere in the fieldtype module. -
I was playing around with multi language field and installed the following modules: Languages Support Languages Support - Fields I added 40 languages, but as soon as i create a new field of the type TextLanguage i get the following error: SQLSTATE[42000]: Syntax error or access violation: 1069 Too many keys specified; max 64 keys allowed I can without a problem add new fields of the type TextareaLanguage so the problem is not in there too. ps. im running the latest dev branch of yesterday
-
@horst thank you for helping and pointing out a way to log the file names to see what is going on. I have placed both lines inside the WireMailSmtp.module and posted the form a few times to find out that nothing is logged. The code is right because putting the following line in the __construct() created the expected log file correctly. wire('log')->save( "debug_attachments", "tralalala");I came to the conclusion that form builder is not realy sending the files as attachments. All it does is save the attachments to /assets/cache/form-builder/form-x/entry-x/ and rendering a 'special' link to those files. So now i'm sure the bug is form-builder related and not in your WireMailSmtp and/or WireMailSwiftMailer module.I will report it in the form-builder forum and see if i can find out something more to backup the bug report with. Update: Haha Ryan is always 3 steps ahead I found this line in InputfieldFormBuilderFile.module // @todo this is producing invalid file links when more than one file on the page
-
@horst @kongondo : i was quoting Ryan, before i edited my post. But indeed the dev branche version is 2.4.1
-
Hello horst, i have installed and tried WireMailSmtp too and installing and sending mail works fine. But i also noted that sending a form with more then 1 file field will send only a link to the first attachment. The second attachment is always 0b (in the email body). While in the FormBuilder Entries both files are uploaded correctly. Seems like a little bug in the WireMail class processing the second file field incorrectly.
-
Thanks horst, the problem was caused because WireMail and WireMailInterface classes where not uploaded by FTP somehow. Installing and sending works now. I just only noticed that a form with multiple upload fields only makes the link to the first attachment available. The second attachment is always 0b and has no link. While in the FormBuilder Entries i can see both files uploaded correctly. Is this a bug in WireMail or the SwiftMailer class? I have a form where the visitor can upload a CV and a Letter (both in doc, docx, pdf, rtf or txt format)
-
I had some problems before that are all fixed now, somehow the following files where not transfered with FTP /wire/core/WireMail.php /wire/core/WireMailInterface.php Installing and sending mail with SMTP worked fine now Thanks for making this module available!
-
how to build a mobile website with another template?
Raymond Geerts replied to leoric's topic in General Support
Another approach would be to have a duplicate of your template folder where you use diffferent code inside your templates. I use this a lot for development in a live site, but its an easy solution to use it for a mobile website too. When your normal site is finished (or while developing) make a duplicate of the template folder and name it "templates-mobile". The goal here is to have exactly the same template files in both folders. Paste the following code at the bottom of the /site/config.php file and change the m.domain.ext to your needs if($_SERVER['HTTP_HOST'] == 'm.domain.ext') { $config->urls->templates = '/site/templates-mobile/'; $config->paths->templates = $rootPath . $config->urls->templates; } This way when you visit your website on m.domain.ext it will use the templates out of the templates-mobile folder while it still uses the same data from the database, assets folder and the modules. -
This is realy great, thanks for implementing this feature. And ofcourse to all who make modules upon it. Does it also mean that when this module is installed, the FormBuilder will be able to send mail through this module 'out of the box'?
-
Discussing it with my college Martijn he came up with the idea of putting a md5 hash of the username in an extra field attached to the user template and do this upon user creation. And since there doesnt have to be any reference anymore to the username it could be a combination of several values like for example a unix timestring. $username = $this->input->post->username; $hash = md5($username."-".time()); But in general it would be nice to know if it is possible to get a user (or page object) with a selector containing a md5 hash.
-
Im working on a sort of "friend request" script for a front end user profile. the user template has the following extra fields of the type Page friend_invite_in friend_invite_out friend_confirmed There will be a ajax post containing the username when pressing a button to send a friend request. Lets say user "A" does a request for user "B" to become friends. The ajax script should handle the post and add the foloowing page references: User "A" will receive a page reference to user "B" in the friend_invite_out field. User "B" will receive a page reference to user "A" in the friend_invite_in field. Then user "B" can confirm, so that the page references are moved in the following manner: User "A" page reference to user "B" will be moved from friend_invite_out field to friend_confirmed field User "B" page reference to user "A" will be moved from friend_invite_in field to friend_confirmed field This i kinda the logic behind the whole process. But to prevent sending clear usernames i would like to have a md5 hash in my HTML/jQuery code. This is no problem to do with PHP. But how would i make a selector that can handle this md5 hash and get the right user? // this does not work! $md5 = $this->input->post->userid; $u = $this->users->get("MD5(name)=$md5"); In MySQL it the query would be something like this (havent tested it) SELECT * FROM users WHERE MD5(name)=$md5