-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
Autocomplete and Other Search Enhancements
Soma replied to Michael Murphy's topic in Getting Started
Ryan, I know that path can't be queried, but it would be possible to have path autocompletion in some way. Do you think it would be good to have a new inputfieldtype for this? I found in certain circumstances using the page reference with the label "title" isn't always clear what page you're selecting, as the "where is this located" question arises. I have ie. a page field to select from 100's of download's (which are pages), so the most practicable and sure option was to use "path" as the label. Problem was since there could be different branches with pages using same or similar names, but have a different parent, defining another category. So instead of selecting from a long list, using the asm select input type, it would be nice to have autocomplete for paths. Some time ago, would have liked to use the PageListSelectMultiple for this, but it would let me select all pages instead of only from the defined "parent". It won't get saved but you can still select it and it gets added to the list, but after a save it's gone, as it's not allowed to be selected, without a message. I thought maybe it would be best to have the pages not allowed to be selected "disabled/locked". And if a parent page is selected only render page list below it. I remember you thought that it's not easy because of how it works now and would require some rewrite. What are you're thoughts on this subject now? -
Autocomplete and Other Search Enhancements
Soma replied to Michael Murphy's topic in Getting Started
Just tried tweetsy to Ryan, but it's better to write here again : Well I thought having a path auto complete would be cool, so typing "/cat.." would "/category/..." I'm not talking about the label. But maybe that works as good, as long as the title/name's are consistent, otherwise it could be confusing. Anyway. Great thanks for the awesome new module! -
You can also use an import method of PageArray. Note that the page array of PW isn't a regular php array, that's why it doesn't work. you could also do something like this. $pa = new PageArray(); $pa->import( $pages->get("/content/")->children() ); $pa->import( $pages->get("/footer/")->children() ); foreach($pa as $p){ ... } You may check out the cheatsheet on the API pages, and look for the PageArray/WireArray sections. There's lots of useful methods. For example instead of this: $contentpages = $pages->get("/content/")->children; unset($contentpages[0]); do this to slice off the first entry in the resulting page array: $contenpages = $page->get("/content/")->children()->slice(0);
-
As far as I know PW does write all the assets from the install folder already.
-
Good thread. Thanks for considering this as it will be a needed feature soon
- 27 replies
-
- private
- protected files
-
(and 1 more)
Tagged with:
-
I've sent you an email with a screenshot of the modules.
-
No there's no restrictions. I'll send you the link to the php info. There's some modules installed but those that I always install and never got that problem.
-
Ok, I cleaned up the code and tested it. I just comited a new version to github. improved database schema removed a lot of not needed functions and code fixed an issue where it wouldn't trigger a change on the hidden form text input, now works with "isdirty" type of js checks, i.e. for save reminder type modules Thanks again Ryan. I may will get back with some questions... but need some sleep now
-
@apeisa, I don't know if it got to do with limited space? ... switched to extended post options ... ok now that is funny, that has to be most funny notice I've seen. There's this line I didn't payed attention closely yet but it says: "Used 2.84MB of your 500K global upload quota (Max. single file size: 100MB)" And yes it's stored as hex. I also thought about wether to chose rgb or hex. And I can't really tell as there's so many option possible, so I just went with hex. I don't know if a converted function or a separate fieldtype or a config option would be best. I haven't really put much more time into it for now, but now that it's working it's time to consider some more possible options. @ryan, you're awesome, you just made my day. Seriously you helped me really a lot just by doing this cleanup. This is great, as I was also thinking about what could still be removed that's not necessary, but I struggled a lot because I'm still learning this stuff. Thanks for the better database shema! Haven't really taken care of that, oh well. Good idea. I will study it to get a little more clear on fieldtypes. Basicly I wasn't sure what really would be needed to create a new one and thought extending text field would be ok, so I copied the text fieldtype code and deleted some stuff but I guess it was a little off still I will implement the changes now and update the rep. Thanks so much for your help!
-
I recently started a new project using PW2.2. I now epxerience strange issues with image upload. It doesn't finish with the status upload bar... but after saving/refreshing it's uploaded anyway. So the only error/warning I see is in firebug. first this one this: <b>Warning</b>: rename(/tmp/WireUploadYsln1M,/home/bagshop/www/dev.bag-shop.ch/site/assets/files/1049/bag-maria-rot.jpg) [<a href='http://ch2.php.net/manual/en/function.rename.php'>function.rename.php</a>]: Operation not permitted in <b>/home/bagshop/www/dev.bag-shop.ch/wire/core/Upload.php</b> on line <b>233</b><br /> [{"error":false,"message":"Added file: bag-maria-rot.jpg","file":"\/site\/assets\/files\/1049\/bag-maria-rot.jpg","size":245876,"markup":"\n\t<li class='InputfieldFile InputfieldImage ui-widget'>\n\t\t<p class='InputfieldFileInfo ui-widget ui-widget-header'>\n\t\t\t<span class='ui-icon ui-icon-arrowthick-2-n-s'><\/span>\n\t\t\t<span class='InputfieldFileName'>bag-maria-rot.jpg<\/span> \n\t\t\t<span class='InputfieldFileStats'>• 240 kb • 920x840<\/span> \n\t\t\t<label class='InputfieldFileDelete'><input type='checkbox' name='delete_product_image_177d172d1ee7e8c9f8e5d315ce45cc98' value='1' \/><span class='ui-icon ui-icon-trash'>Delete<\/span><\/label>\n\t\t<\/p>\n\t\t<p class='InputfieldFileData ui-widget ui-widget-content'>\n\t\t\t<a class='InputfieldFileLink' target='_blank' href='\/site\/assets\/files\/1049\/bag-maria-rot.jpg'><img src='\/site\/assets\/files\/1049\/bag-maria-rot.0x100.jpg' alt='bag-maria-rot.jpg' \/><\/a>\n\t\t\t<label class='InputfieldFileDescription infield'>Description<input type='text' name='description_product_image_177d172d1ee7e8c9f8e5d315ce45cc98' id='description_product_image_177d172d1ee7e8c9f8e5d315ce45cc98' value='' \/><\/label>\n\t\t\t<input class='InputfieldFileSort' type='text' name='sort_product_image_177d172d1ee7e8c9f8e5d315ce45cc98' value='0' \/>\n\t\t<\/p>\n\t<\/li>","replace":true}] and then right after this: JSON.parse: unexpected character ...unction(h.promise)?h.promise().then(d.resolve,d.reject) [g](h)}):b[a](d[g])})})... It tried in crhome, safari, ff ... always same procedure. What's going on?
-
ColorPicker Custom Fieldtype/Inputfield for ProcessWire 2.+ This module gives you a new custom Fieldtype. Let's you select a color using a Colorpicker jQuery Plugin. The color selected will be stored in HEX format uppercase: "EAEAEA"; To use it in your template as a background HEX color, you'd simple output the value and prefix it with a #: echo "background-color: #" . $page->color; When creating a new field in the admin, you can set a default value the field should be prefilled with when creating a new page. The field supports a "reset" button to be able to set it back to the default value. The colorpicker used: ColorPicker jQuery Plugin by Eyecon Since 1.0.6 the colorpicker supports color swatches to add predefined colors for easy selection. Thanks @Rayden for the implementation. How to install: Download the contents of this repository and put the folder renamed as "ColorPicker" into your site/modules/ folder Login to processwire and got to Modules page and click "Check for new modules". You should see a note that two new modules were found. Install the FieldtypeColorPicker module under "Field" section. This will also install the required InputfieldColorPicker at the same time. Done You can now create a new field with the "ColorPicker" Fieldtype. Get it from modules section: http://modules.proce...e-color-picker/
-
Is this a proper way to get an image from the Home page?
Soma replied to MarcC's topic in General Support
Maybe try a var_dump on $newsletter->sidebar_image or alike to track down the problem -
Just noticed that when I use the clone function for a FieldsetTabOpen, it doesn't clone the closing field.
-
Videos inside processwire: How to embed videos inside processwire?
Soma replied to jester.vergara's topic in FAQs
ProcessWire's TinyMCE is configured to not allow all tags. There was some thread concerning exactly this subject not so long ago. that might help. In the field settings you'll find the TinyMCE advanced configuration settings under "input" tab. Otherwise it's also possible to setup a textfield you would only put the video url into, and use that in your php template, so you don't need to enter the whole code in the RT. Depends what you want to do but I would go with this. -
From the thumbnails module thread: <?php $page->image->getThumb('thumbnail'); // single image field $page->images->first()->getThumb('thumbnail'); // multiple images
-
Thanks Ryan for testing. I do "exactly" what you do. Hmm, not sure what's causing it. I've run a few tests. It didn't happen on a local test install, but on the zueblin.ch website I did. I've removed the bramus css extras plugin to make sure... still same issue. I have 2 TinyMCE fields on same template, so I thought this might be the next one to try. And then I tried to reproduce on my local install and I got same issue suddenly! Can you also try?
-
I just discovered a bug I think. While tracing down a PW site with lots of assets and pages to scan for all images and links in the RT text fields, I discovered that there's some multiple links that appear to be empty, not visible. So I figured that when inserting a external link in the RT, using the PW link dialog, then afterwards open it again to edit, it then inserts a invisible empty <a href="someurl"></a>" right before the link meant to be changed (which stays untouched). I'm sure it's not browser specific, but my guess is that the PW inser link plugin need a check. It only seems to fail with manually entered external links. I would consider this urgent to fix soon. I now need to go manually go through all them because it isn't something the client nor me have known. Though with the bootstrap script I wrote to scan whole site and look for such things it's a whole lot easier thanks to the easy as pie API. Thank for anyone confirming/reproduce this bug.
-
You're right, thanks for the suggestions. But I need the blank values to be 0 for the chart, so I implemented a check that sets not filled in fields to 0. I know it would be possible to check for them in the output, but wanted to make it simple as possible. Thanks for pointing out the typo! Must have been sleeping...
-
I'm in need of a special inputfield with multiple input form fields. I created a little Inputfield extending InputfieldTextarea and using it for storing the values as json encoded string. Seeing an example of Ryan recently using this technique I went and tried to do a little custom Inputfield. I got it working so far with a little try and error, but wanted to have feedback, if there's anything done wrong or could be done better. I need this to store numeric values for the 12 months. These will be used to render a chart on page. So I first did a simple textarea and having each values on a new line, but wanted something more intuitive and convienient for the client to enter the values. (I know it would also be possible (and maybe better solution) to write a complete new Fieldtype/Inputfield, but I'm not really into it yet and would need some help. But this was kinda simple and does the job, only drawback is that it wouldn't work with selectors as it's stored as json in a text field in db.) Here's my code: <?php /** * ProcessWire Custom InputfieldMonths * * Inputfield that stores numeric values for the 12 months of a year. * */ class InputfieldMonths extends InputfieldTextarea { protected $months = array( "January" => "jan", "February" => "feb", "March" => "mar", "April" => "apr", "May" => "may", "June" => "jun", "July" => "jul", "August" => "aug", "September" => "sep", "October" => "oct", "November" => "nov", "December" => "dec" ); public static function getModuleInfo() { return array( 'title' => 'InputfieldMonths', 'version' => 100, 'summary' => 'Stores 12 integer values for months of a year', 'permanent' => false, ); } public function init() { parent::init(); } public function ___render() { $values = json_decode($this->value,true); $out = ''; foreach($this->months as $label => $name) { $out .= <<< _OUT <p> <label for='$name'>$label</label> <input id='$name' name='$name' value='$values[$name]'/> </p> _OUT; } return $out; } public function ___processInput(WireInputData $input) { foreach($input as $key => $val) { if(!in_array($key, $this->months) or $val === '') continue; if(!is_numeric($val)) return $this->error("Wrong format. Value '$val' is not numeric!"); } $months_values = array(); foreach($this->months as $month) { $months_values[$month] = $input[$month]; } $data = json_encode($months_values); if($this->value != $data) { parent::trackChange('value'); $this->value = $data; } return $this; } }
-
WELL, the "invisible" button is still there after to open it again... Edit: Button is actually like 10% opaque...
-
Erhm no I mean yes I got Email noti .. I did nothing just wait dunno why. I also got yours from this message
-
WOhoooooooo I got a notification! Apeisa thanks!
-
There's actually two x button there when you hover over recent topics box. The overlaying blackish one will hide the sidebar forever. Works for me.
-
Just wanted to hook me in. Great idea Nico. Thanks for the module! I will check it out soon, as it's a often requested feature.
-
Hey welcome cbuck! You're not an idiot, it's ok to ask and feel dumb... You should be able to easily grab page using an instance of the category page for example.. <?php $cat = $pages->get('/blog-categories/news'); $pa = $pages->get('/blog/')->find("pagefield=$cat,template=blog-entry"); // "pagefield being your page reference field used for the categories you could also check with multiple (PageArray) categories. Same goes for sections, just combine them if you wish. You would just cycle through your categories/section and use the page object to find all blog entries with the code above. Pretty straight forward.