-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
hi kixe Good to hear you stay with PW and making progress. What approach are you using for multilanguage? Separate tree or same page with language fields? Well as you might already found out, language on front-end is default as user language has no effect apart from the backend. The url is the starting point for your php script to define what language is accessed and you then set the $user->language according. So if you have language segment domain.com/en/ you get the first segment to read what language the user accesses. When using the new language page names module this is done automatic. So the only thing you need to to is a language switch so the user can change language. I've seen you posted also in the language page names module thread... the last example of Ryan is currently the most easy way (requires latest dev version).
-
Has come up a cuple times http://processwire.com/talk/topic/546-how-to-detect-an-empty-field/
-
You could either just wrap the whole in a form, don't see any problems to do so even if the form fields are just in one tab. Have a separate process executeUpload() where you build the from.. and have a button with the href ="upload/". Or simply add a wrapper yourself (You can't just use InputfieldWrapper as a main wrapper with a ID, or I don't know how because it's not for such purposes) and use a main IntpufieldWrapper to render the wrappers... In a process module execute $wrapperMain = new InputfieldWrapper(); //...add all tab wrapper to the main. return "<div id='MyTabs'>" . $wrapperMain->render() . "</div>"; Then the js would be as simple as $(function(){ $t = $("#MyTabs"); $t.find("script").remove(); // to avoid double script execution $t.WireTabs({ items: $("#MyTabs > .Inputfields > .InputfieldWrapper"), id: 'ProcessExampleTabs' }); });
-
while(youcan < youshould) { // do what you want } Well use foreach... It's just a matter of preference and you could even use for() foreach() while() A while loop with a PageArray would look like this: $res = $pages->find("template=somexy, limit=10"); $i = 0; while($r = $res->eq($i)){ echo $r->title . "<br/>"; $i++; }
-
http://processwire.com/talk/topic/1593-how-can-i-specify-default-value-for-certain-input-field/ http://processwire.com/talk/topic/2199-checkbox-default-value/ http://processwire.com/talk/topic/394-default-field-value/ http://processwire.com/talk/topic/2460-possibility-to-pre-select-a-page-field/ There's more about that subject and it's not always around options but also on text fields etc. Maybe this is also interesting in your case: mods.pw/3b
- 8 replies
-
- radios
- page field
-
(and 1 more)
Tagged with:
-
It's not always good practice to have default value set for various reasons and there's some discussion about it in the forums. You have "normal" .. is it really needed to have that as a selectable state? All default entries are "normal" and should be handled in template code. Just create option with dropdown (as radios have no blank) and have "important" and "very important" as states.
- 8 replies
-
- 2
-
- radios
- page field
-
(and 1 more)
Tagged with:
-
The feature is already there. Look niks post. ;-)
-
Unable to complete request... no error log, debug or email.
Soma replied to Fourjays's topic in General Support
Pulled from github? Are really all files being pulled? "Unable to complete this request due to an error." And no error logged even with debug mode on? Are you sure? That sounds strange. Looks to me like some files are missing or corrupt maybe? Or cache? -
Page edit per user and template access, how do they relate
Soma replied to caribou's topic in Modules/Plugins
It's simple... "getAllowedTemplates" isn't hookable (just read that philipp made it hookable... sorry) That sentence doesn't make much sense to me... (as some of my own sometimes ) -
$pages->get('name=$name'); $name won't get parsed. You need in this case have double quotes "name=$name" or PHP doesn't replace $name with its value.
-
Select field values not getting edited in front-end form
Soma replied to onjegolders's topic in General Support
Ah ok just looked at source again and it seems it doesn't matter if output formatting is on or off... $page->invoice_terms = (int) $input->post->edit_status; is correct (for single page field), if the edit_status is the id of the page you want to add. Is practically the exact same as doing... $editTermsId = (int) $input->post->edit_terms; $page->invoice_terms = $pages->get($editTermsId); just this is having an additional not necessary db query. $pages->get($editTermsId) will return the id again.- 24 replies
-
- api
- front-end form
-
(and 1 more)
Tagged with:
-
Select field values not getting edited in front-end form
Soma replied to onjegolders's topic in General Support
If output formatting is off, it doesn't matter.- 24 replies
-
- api
- front-end form
-
(and 1 more)
Tagged with:
-
Select field values not getting edited in front-end form
Soma replied to onjegolders's topic in General Support
If it's a multiple page field (or no output formatting!) you just do $page->invoice_terms->add((int) $input->post->edit_status); add() works with page array, page or id's- 24 replies
-
- 1
-
- api
- front-end form
-
(and 1 more)
Tagged with:
-
@jmartsch, I think you encounter the same as the previous poster? is openssl installed? I just pulled in an update from petsagouris with multitude of changes, one of which checks for the openssl module being installed. udpate 1.0.7 - multitude of fixed and code cleanup (@petsagouris) - added check for openssl module required for https download stream (@petsagouris) - added back to Modules Manager button on download/update screen
-
Working with ProcessWire & getting EXIF data from images
Soma replied to MarcC's topic in General Support
Nice one Horst! I don't think you have to add the images_exif textarea to have it work. I thought the meta data function always gets called regardless, it's just that it only tries to write infos when that field is found. Second one is I pushed an silent little update to the FF bug with the tag field some time ago already. -
Hey Peter glad you like it. 1. I think there's tons of examples out there. I agree it can be tricky if you're not into it so much. I often use a drop-down script (with some basic CSS) I modified some time ago, it's also used in my Teflon theme. https://github.com/somatonic/droppy it doesn't require anything except jQuery and some CSS. There's also CSS only ways to do it. 2. I'm a little careful not to add even more options. This I agree can be handy, since it's also possible use external urls. I think there's different ways to achieve it already what you want without adding more. xtemplates, xitem_tpl, options for example, but it would only be possible to add it to all links that have the template you define there. But there's another way that is possible since a couple versions. Adding a hook to the link item being constructed and modify it. Here simple example for use in templates: function getTagsString(HookEvent $event){ $tpl = $event->arguments[0]; // the template string $page = $event->arguments[1]; // the page getting rendered if($page->open_blank){ // $event->return is the complete link you get from the hook, modify to you needs $event->return = str_replace('href=','target="_blank" href=', $event->return); } } $treeMenu->addHookAfter('getTagsString', null, "getTagsString"); echo $treeMenu->render();
-
Hmm, wire("modules")->get("ImagesManger")->options[key] should be enough The module sets the options array in the init. But you can also get it when you hook setMetaData() with $event->object->options['imagesEXIFField'];
-
You can already get the settings via the module options.
-
The hook does already allow you to do any additional custom field saving... Just add field you wish and populate it in the hook. Thx I'll have a look. Forgot FF isnt consistent across OS. I think I know what it is.
-
Hey Mr MetaData! Yeah sure why not. Since it does add value and it's only optional I think this is good idea to add. I just went ahead and added support for MetaData in my last commit. You could now add a field "image_exif" and get the EXIF data stored when uploading images. I made the method setMetaData(), which adds the meta data on page/image creation, hookable so you can do a hook on it to store additional data. Not sure if this a good idea but maybe nice to have. v 0.0.3 fixed issue with images getting added twice to the assets folder (hope this is now ok) removed the performance intense pages search for image tags (In my testinstall with 120k pages this result in many second waiting to load the data table. and just output a link on all images to a PW search that will run a search. added EXIF data support. Let me know if that EXIF data reading is ok, or if it need a more sophisticated method. You can hook the Meta Data method like this from a autoload module: $this->addHookAfter("ImagesManager::setMetaData", $this, "hookMetaData"); public function hookMetaData(HookEvent $event){ $page = $event->arguments[0]; // page that the image will be added $file = $event->arguments[1]; // path of file in temp upload folder // do whatever you like $page->yourfield = "I'm the Meta Man!"; // will be saved to page }
-
Replacing default language or just using the Pages Name module?
Soma replied to landitus's topic in Multi-Language Support
I think what's wrong is that you get the field object and not a value. $pt_field = $item->$field; and $item->$field = $pt_field; If you would output the $item->$field; you'll still see the old value I guess. If you would stringify by either add "$item->$field" or (string) $item->$field it would work. Also you're cycling each field on page I think isn't good idea. You should restrict to those fields that you want to change. I would do this instead, with an array you can define what fields, and also use the $field->getLanguageValue(langID) to get values. // define fields you want to change $fieldsArr = array('title','body'); $langAlt = $languages->get("de"); $langDefault = $languages->get("default"); $pa = $pages->find('/about/'); foreach($pa as $p){ $p->of(false); foreach($fieldsArr as $field){ $title = $p->$field->getLanguageValue($langAlt); // get the alternative lang value $p->$field->setLanguageValue($langDefault, $title); // set the new value } $p->save(); } -
Replacing default language or just using the Pages Name module?
Soma replied to landitus's topic in Multi-Language Support
Maybe you have to save the page and not the field. Also change $page to something else. -
The connection is failing before PW gets to know which page. I experience this on some "bad" hostings from time to time. That may seems it doesn't allow for enough connections because either too many people request or some connection didn't get closed to mysql for some reason.
-
Damn, and I don't have a netbook!
-
Dont you need to put the script outside after the div?