-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
I just ran into the same problem with float (apeisa shop). It worked well until I added the german language pack! Now it breaks it, and in german the decimal point it a comma. The locale in the translation is set to de_DE.UTF-8. Removing it works again but then the locale is lost? What is the problem really? How can we deal with this reliably? It just that the setlocale where it has comma instead of point the round, floatval float operation fails. I can for now just disable the setlocale for german, but would be nice if not.
-
Thanks, I corrected and rewrote part of it.
-
A quick tutorial how to create file downloads using pages You will be able to create a new page using template "PDF" (or any you setup), upload a pdf file. You then can select this page using page fields, or links in Wysiwyg. The url will be to the page and NOT the file itself. This will allow to keep a readable permanent unique url (as you define it), unlike /site/assets/files/1239/download-1.pdf, and you'll be able to update/replace the uploaded file without worring about its filename. Further more the file will also have an id, the one of the page where it lives. Clicking those links will download or open the file (when target="_blank") like it would be a real file on server with a path like /downloads/project/yourfile.pdf. You'll be also able to use the "view" action directly in the page list tree to view the file. Further more you'll be able to esaily track downloads simply by adding a counter integer field to the template and increase it every time the page is viewed. Since the file is basicly a page. This all works very well and requires only minimal setup, no modules and best of it it works in the same way for multi-language fields: Just create the language alternative fields like "pdf, pdf_de, pdf_es" and it will work without modifying any code! Still with me? ok PW setup Download folder: Create a template "folder" or "download-folder" with only a title needed. Create pages in the root like /downloads/project/ using this template. Setup the template for the pdf files 1. Create a new template in PW. Name it pdf 2. Goto template -> URLs tab and set the URL end with slash to no. (So we can have /path/myfile.pdf as the URL) 3. Create a new custom file field, name it pdf. Set its maximal count to 1 under -> Details tab. 4. Add the pdf field created to the pdf template. Easy. 5. Create a new "pdf" page using the pdf template under a download folder you created earlier. 6. Give it the title and in the name field add ".pdf" to the end (could also leave as is) Template PHP file for the pdf files 1. Create the template file pdf.php in your /site/templates folder 2. add the following code: <?php // pdf.php if($page->pdf){ wireSendFile($page->pdf->filename); } Done. To see the options you have with PW's wireSendFile() you can also overwrite defaults <?php // pdf.php if($page->pdf){ $options = array( // boolean: halt program execution after file send 'exit' => true, // boolean|null: whether file should force download (null=let content-type header decide) 'forceDownload' => false, // string: filename you want the download to show on the user's computer, or blank to use existing. 'downloadFilename' => '', ); wireSendFile($page->pdf->filename, $options); } Simple and powerful isn't it? Try it out. Some thoughts advanced Create as many file types as you like. It might also be possible to use one "filedownload" template that isn't restricted to one field type but evaluate it when being output using $page->file->ext, or save the file extension to the page name after uploading using a hook. One last thing. You can add other meta fields or preview images to the template and use those to create lists or detail pages. It's all open to goodness. Again all without "coding" and third-party modules. Further more you can use the excellent TemplateDecorator to add icons per template and have a nice pdf icon for those pages. This as a base one could also easily create a simple admin page for mass uploading files in a simple manner, and create the pages for the files automaticly. ImagesManager work in the same way. Cheers
- 20 replies
-
- 37
-
-
-
i.e. for me $f = $fields->get("select_download"); if(is_subclass_of($f->inputfield, 'Inputfield')) { echo "is subclass"; } works locally with php 5.3.1 while $f = $fields->get("select_download"); if(is_subclass_of($f->inputfield, 'InputfieldPageListSelection')) { echo "is subclass"; } doesn't work. But it does work on another server with php 5.3.8.
-
I know there was some additions and changes right there where it checks for a valid page. Playing around it works in older dev version, but not latest. I figured that on my local install is_subclass_of($instance, "InputfieldPageListSelection") fails for me but shouldn't. Since this is only called when not on a direct child of the parent specified it won't even get to this check (for pages right under the parent). I'm not sure is_subclass_of works same for all php version (5.3 5.4) and since the InputfieldPageListSelection is only a interface (implements) I'm not sure what's about it. I also noticed some strange parents() results on those page while testing. No idea why.
-
Thanks so much adrian for testing! I think you have it right, but not sure, there's nothing that special on the language side, the root page has "/en/" and "/de/" for it's names. Strange, as soon as I specify a template I can select and save the page that previously didn't work. So it also seems some pages work and some not. Further more I have the custom page list label module installed and it stopped also working for some pages... *confused* I will test again on a different install.
-
Sorry maybe I got an older version indeed. I install VIA ModulesManager
-
I'm using latest dev. Multilanguage support and multilanguage page names. I have a page field PageListSelectMultiple and a parent to select pages, no template spec. Now I can't select a page that is more down than on root level from parent. I get Page 5216 is not valid for select_download No matter what setting. Multiple, single, template I always get this error and can't go on... This was never an issue. Can anybody confirm?
-
Hmm, I have latest dev an language support. I tried and disabled plugin already, no luck.
-
@adamspruijt long time no see! still around? Also wanted to note that if you download the module from modules repository I still get 1.0.7, but the newest is 1.0.8!
-
Anybody can confirm?
-
I'm not able to find it though.
-
1. I noticed a strange thing when using $page->image->size(0,50)->url; and the image is already 50px height the image variation won't get created! 2. I also remember someone else mention this, but haven't been able to search When I have a image that has like 200x800px (extreme portrait) and using upscaling=false $page->image->size(200,100)->url; will create an image that isn't 200x100 !? I think it has to do with the ratio and the upscaling feature. When I set upscaling=true it doesn't work. Anybody able to reproduce.
-
Interesting bump
-
I think I have discovered a bug with images. When using the save+test feature, i get errors with image field. THe image field is a single image field and I write: $page->image->size(0,50)->url TemplateFile: Method Pageimages::size does not exist or is not callable in this context So no matter what image field max files is set to it's always threated as array. But on front-end the code works, just not in the preview/test. I have to write $page->image->first()->size(0,50)->url to make it work in the admin preview, but then the code doesn't work anymore on front-end. Ace editor: I already got this with the ace editor fieldtype from adam, the code has tabs added at the end of the text. Sometimes it grows and grows after saving the code...
-
I figured this doesn't trigger when using good old Fredi. The nice thing it would be simple to add support cause of modulotastic PW if($this->modules->isInstalled("FrediProcess")) { $this->addHookAfter('FrediProcess::execute', $this, 'loadTabs'); } Shall I make a PR or would you consider adding it? Thanks
-
Something related to this maybe. Another detail I'm seeing is that repeater pages that are saved in the admin branch don't have the status for alternative language set to active. Is this intended or was it missed somehow? Since I can't set it via the repeater I think they should be active by default? Not sure what the intention is/was.
-
Thanks Nik fr confirming. Another thing: (was my problem only) Further more I noticed something else again maybe related. I created repeater items via API for those pages. Now I can't access them with $page->repeater->first() $page->repeater->first() // doesn't return the first repeater although it's there. Once I go to edit the page and change a value on that repeater item and save, it works. Ok this is my fault sorry. I was using the Shop module and the integer value is required to show the add to cart and I missed that it requires the price to show.
-
This also maybe has to do with repeater field being added to pages that already exist. I created repeater via API on those pages and once I open them in the admin I get the notice above and only default text input instead one for each language. Once I reload the page the notice is gone and the title language field is again correctly showing language inputs.
-
Testing further: Deinstalled Language Support to rule that out. Now I found out: The repeater.count=0 only works for pages that are once saved after the repeater is added to the template. So to say it different: For pages that are not yet saved, once after the repeater was added to the template, it doesn't find them.
-
I can't get the pages that have repeater.count=0 No results: $pa = $pages->find("template=basic-page,myrepeater.count=0"); doesn't give me the pages where there's no repeater element created yet. Works: $pa = $pages->find("template=basic-page,myrepeater.count>0"); this works correct $pa = $pages->find("template=basic-page,myrepeater.count=2"); this also. I have Language Support installed, in case that matter at all. I have tested in different installs and I can't get it to work, but thought I was able to do this count=0 on repeaters the other day. Anybody able to reproduce this?
-
Multilanguage support installed. Latest PW dev. A repeater with the page title language. When adding a new item to the repeater, the title field only shows 1 input and not for all languages. This is on first time adding item, after saving I get Notice: Trying to get property of non-object in /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/modules/LanguageSupport/LanguageSupport.module on line 209 Notice: Trying to get property of non-object in /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/modules/LanguageSupport/LanguageSupportFields.module on line 131 Only after saving the page yet once again , the page title are shown correct in repeater with input for each language. Anybody abel to reproduce this? It happens all in different installs I have.
-
I don't have a public install, so I just setup a test intall on my ISP. As it's nothing special to a install or project, it's a general things happening on all installs. But meanwhile I get another error.... so even more confusing... So this is still about the repeater thing and editing/saving pages on front-end on a alternative language. I sent you a PM Ryan. (The issue mentioned last, with "field_title.data1011" for default lang, is a completely different case, and no repeater involved there)
-
The advanced image scaling inside TinyMCE doesn't work anymore for me in Chrome/FF lately I tested in various installs and version. Anybody can reproduce this? Mainly it's when inserting an image and drag resize it, in Chrome it completely messes up the image (not shown anymore) and in FF it also screws up. There's error shown in some and some not. I tried to get the hang of what's wrong again with this as I fixed some issue for Chrome a while ago. I'm getting tired of wywiwyg!!!