-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
Might be what he looking for after reading again. That will look for pages with the "images" field populated.
-
It's hard to understand what exactly you want to do. Can you also try to put some spaces between your words? Thx. You can grab an image using the image field name. If its setting is to allow only a single image file you can do: // single image field echo $pageobject->imagefield->url; echo $pageobject->imagefield->size(100,100)->url; If the image field is set to allow multiple images, you must use a loop to cycle through them, or chose the first, or maybe a random one. // multiple foreach($page->imagesfield as $img){ $thumb = $img->size(100,100)->url; echo "<img src='$thumb' />"; } // or chose first from image array $page->imagesfield->first->url; // or random $page->imagesfield->getRandom(1)->url; // grab pages using a special template and output a list of their images. $pa = $pages->find("template=yourtemplate"); echo "<ul>"; foreach($pa as $p){ $thumb = $p->imagefield->width(100)->url; echo "<li><img src='$thumb'/></li>"; } echo "</ul>"; Does that help you? If not can you provide better and more information what you want to do?
-
Translation in templates using language module
Soma replied to Soma's topic in Multi-Language Support
Ah ok, thanks Ryan, now it works this way. Just got some OT question. 1. When installed there's the default language, which is english. When I create a new language let's say german I would name it "de" so I can use it for front-end translation and user/guest language as the url segment /de/somepage. I most of the time use it like this and in the page tree I create /de/ and /en/ for the language pages. Now I recognized that I can't change the name "default" to like "en". Edit: Damn! What was I thinking... meh... thinking more about it , it makes sense to have "default" as a constant, as otherwise one wouldn't be able to know what the default language name would be . And for using it in a multilang setup it's just a matter of checking for "default" and set the language path segement to "de" or "en" as the global front end lang var. 2. And another one is I just question myself, what do I do when I want to specify german as default? Ok I guess I can drop the german language json package into the default. And then? Create an english language package for the english version? -
I'm trying to get the a translation to work in the search result template. I got this: $searchresult_out .= sprintf(_n("Found %d page matching your query:", "Found %d pages matching your query:", $searchresult_count), $searchresult_count); And it doesn't show up in the translation edit page. Any ideas?
-
I think I found it. When I remove the "template=product" it works. but it only lists the direct childs of the parent. So kinda same issue as with the other problem before. Not big deal, as I can just use the "template=", but I would expect it to look through all pages below the parent not just direct childrens. If that's really the problem. Edit: I would work with the php custom code "return $pages->get("/produkte/")->find("template=product");" that's what I kinda thought it would do with the custom selector string option when using parent. But guess I'm wrong. Edit: I also thought using a parent would be more performant when going with a parent instead to search through all pages. It's also dependent on my setup why I ran into it. Produkte is like /produkte/ ---/category1/ ------/product1/ ------/product2/ ---/category2/ ------/product3/ ---/category3/ ------/product4/ ------/product5/ ...
-
@apeisa, not much except that I like it fancy seriously I like the bar item it adds with a trash icon, opposed to having a simple dropdown. I always thought it is more clear to the unexperienced user, but it may be more personal preference. @Ryan, I still can't get it to work. I have same setting as you, I checked various options, it doesn't matter if single or multiple or what select input type.. strange. Whenever I remove the parent in the custom selector it works. ?
-
Thanks for the fix. Yes as i mentioned im using asm select. Nothing special else. Does it work for you? It even shows an example there... using same selector, but cant get it to work. Im also have it set to single page.
-
Now trying other options. WIth the new "custom selector" option. I enter "parent=/produkte/, template=product" there and no pages show up in the ASM select. When I change it to "template=product" it works. The parent page /produkte/ is hidden. But even with "include=all" it doesn't work. Guess it must be another problem.
-
I'm using latest PW 2.2 I experience a problem with the page field. When I define a page as the parent like /produkte/, and as select type I chose PageListSelect. No other options. Then on page where this field is, I go and select a page from the tree, after saving page it isn't there anymore. I figured that it happens only when I select a page further down. If I select a page from the direct child of the parent it works. A bug? /produkte/ --- /page1/ (works) --- /page2/ (works) ------ /page2a/ (doesn't work) --- /page3/
-
What if I have a dashboard I want to list pages the user has access and are unpublished? Edit: Ah, is check_access checking only for if a page is "viewable" or not by the current user? So it doesn't check if a page is editable? I got it working in my dashboard "unpublished pages" widget to list all pages and I'm additionally checking in the foreach loop if the page is editable and output it with a link or not. But drawback is that I can't use pagination or limit=10 with this technique when I don't output the not editable pages in the loop. Is there any solution to this problem?
-
That's really great to have the arguments by name and not position! Thanks Ryan for the update. But I'm not quite getting the last one. Maybe a little example could make it more clear?
-
apeisa is right, I just checked my dashboard module. i'm getting old as for acces, isn't the "check_access=1" what you mean, to only include accessable pages?
-
I'm not getting what exactly you want to archive with published or not. Every page ist published or not. There isn't more. Are you trying to check if it exists or not? Edit: ah there's no "published" I think, only "unpublished" so try "status!=unpublished, status=unpublished"
-
Autocomplete and Other Search Enhancements
Soma replied to Michael Murphy's topic in Getting Started
You're right Ryan, sorry, using the "parent" does only show the part. I think I was mixing up something. Yes it was when using template restriction. As mentioned it would be cool to have pages "disabled" that aren't allowed to be selected to avoid the problem. As for the autocomplete with a new inputfield type, I was thinking of a way to extract the "name" information using a site map list as a string, to then compare. Or maybe something with using get/find on the "name" and then successively complete one url segment after another, just a shame that it doesn't work with fulltext index searches, as it would be much easier. But maybe I'm going to far, and it isn't really something needed that. -
Autocomplete and Other Search Enhancements
Soma replied to Michael Murphy's topic in Getting Started
Thanks Ryan, but I think you kinda missunderstood what I was trying to say. But that's my fault, because I struggle to explain it clearly. I was just trying to explain where I'm coming from that I think autocomplete for paths could be useful. But this gets complicated with all those terms we use and lots of options... apart from that I struggle to get the point clear. But your explanations may help understand a little more. I didn't knew for example that the "name" field only works with "=" and not "*=". I think something along your second route would be possible, but I guess a special inputfield would be required to search for paths using strpos and finds and the like. Anyway. For the first part: Yes that's the setup I ended with, when trying your new AC module, "path" as label and searching on "title". I think this work also nicely. Secon part: BUT my point was, that in the one project I had to chose the asm multiple select along with the "path" as label and then using a custom code to pull pages from the download section pages. (Pretty nice option there!), but when setting it up, I would have really liked to use the "PageListSelectMultiple" input type for that. So they can browse for the download pages. Don't get me wrong this "works", but my point was that it isn't hiding pages from the tree that aren't allowed to be selected. If I for example define a template or a "parent", it still will let me select a page that isn't allowed in the first place (as reported some time ago already). It just isn't well to allow page to be selected from the tree, when it isn't allowed, but it gets added to the list and stays there until I save page, then it is removed from the selected pages. If you still don't know what I'm talking about, I'll record you a video showing it. -
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?