-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
If you have the config field mentioned in TinyMCE field it should work in latest PW. Make sure you have entered and setup everything correct.
-
For more easier (without exploding head) sitemap generation take a look at the MarkupSimpleNavigation module. http://modules.processwire.com/modules/markup-simple-navigation/
-
Ok got it. I updated the code above, it produces valid nested ul and even some indentation. Don't even ask why it works, it just works. It's magic.
-
You're having a function in a function and some complexity not really needed here. This is the simplest way: function siteMap($page, $output='') { $output .= "\n\t<li><a href='{$page->url}'>{$page->title}</a>"; if($page->numChildren) { $output .= "\n\t\t<ul>"; foreach($page->children as $child) $output .= str_replace("\n", "\n\t\t", siteMap($child)); $output .= "\n\t\t</ul>"; } $output .= "\n\t</li>"; return $output; } $homepage = $pages->get("/"); $siteMap = siteMap($homepage); echo "<ul>".$siteMap."</ul>"; Edit: Screw it I got something wrong. Edit: updated to really work.
-
What have you defined in the content.css? It needs to have something in there to work. Like: p.lead {} Classes like: .lead{} won't work
-
Thanks Ryan for the module! Sooo many new things to test out I run out of time.
-
Not sure what you mean. It's context aware so without focusing a element in the text that actually has a class defined the dropdown is disabled. If it's not otherwise it's may a your browser.
-
Since a latest updates to TinyMCE inputfield there's an option to add custom plugins from outside the core to TinyMCE on a per field basis. Here's an example how to add the bramus_cssextras plugin. Ok download the plugin http://www.bram.us/p...xtras/#download 1. create a directory in your site folder i.e. "/site/tinymce" 2. create a plugins folder in it i.e. "/site/tinymce/plugins" 3. put the folder "bramus_cssextras" in there 4. put a content.css in the "tinymce" folder (this is where you can define classes or id's, like: p.lead {...}, ul.list {}, h2.red{ ... } ) (see bramus_cssextras homepage for further infos) 5. now go to the TinyMCE field you want to use it. Under tab "Input" you'll see a "TinyMCE Advanced Configuration Options" collapsed. Open it. 6. add the buttons to one of the theme_advanced_button fields: "bramus_cssextras_classes,bramus_cssextras_ids" if you don't need id's leave it out 7. add the content.css to the content_css field setting like: "/site/tinymce/content.css" 8. add plugin to "Third-party plugin" textarea field like: "bramus_cssextras: /site/tinymce/plugins/bramus_cssextras" as one line. Done. You should now be able to select the class "lead" when cursor inside a <p> tag. Add as much css classes or id's to the content.css as you wish, bramus_cssextras will autodetect them. Have fun.
-
Ok download the plugin http://www.bram.us/p...xtras/#download 1. create a directory in your site folder "tinymce" 2. create a folder in it "plugins" 3. put the folder "bramus_cssextras" in there 4. put a content.css in the "tinymce" folder (this is where you can define classes or id's, like: p.lead {...}, ul.list {}, h2.red{ ... } ) 5. now go to the tinymce field advanced settings 6. add the buttons to one of the button fields "bramus_cssextras_classes,bramus_cssextras_ids" if you don't need id's leave it out 7. add content.css to content_css field setting like "/site/tinymce/content.css" 8. add plugin to third party text field settings like "bramus_cssextras : /site/tinymce/plugins/bramus_cssextras" as one line Done. You should now be able to select a class "lead" when cursor inside a <p> tag. Have fun. I'll create a topic for that too so anyone looking for it can find it easier.
-
I'm officially confused. Not sure exactly how you're doing things but I feel it could be done differently. You want them to specify paragraphs but at the end don't want them to be there? Edit: Wrapping paragraphs in <p> is the usual and wanted behaviour. If you want be able to set styles to tags, take a look at the bramus_cssextras tinymce plugin that can be installed from outside, you could use the "third party" config to install it. This will allow you to define classes used explicitly by paragraphs or headings, something not really possible with default tinymce class select. Let me know if that would be something for you and I can lead you through installing it.
-
But then I question why you want to strip paragraphs? Usually we use the TinyMCE to have them. So can't you just simply use a textarea?
-
You can add additional configuration in the field setting "tinymce advanced setting" under input tab. There you have a field you can enter key:value for configuration. Like skin-variant: silver The value doesn't need apostrophs.
-
But do you understand it now? I think the real problem is in that we use same terms with different meanings. Some know more some less. And sometimes we forget about it so it's sometimes really hard to understand and find out what some people are asking and what the problem is. Some deal different with it than others and some keep out. I must confess I might took some things for granted and in my world and assumed you would understand. So don't take that personal or anything like that. And if something doesn't make sense what I'm saying we can try work it out. I'd like to help you really. Your 'different' looks like you mean 'code' is different. The 'different' we were talking about was that image field can be either of single or multiple thus the code has to be different. You also was speaking about that it would be 'different' in repeaters... So actually it's still the same BUT the repeater add a level or complexness (is that even a word?) to it I think you might not aware of. Looking at your two examples of code you seem to miss that those, both foearch loops to iterate the entries of an array, the first on is a image field with multiple images, and the second example is the repeater field (which is also an array) So let's assume you have in both examples an image field of multiple. foreach($page->my_pics as $pic){ //$pic is now one of $page->my_pics echo "<li><a href='{$pic->url}' class='pic' title='{$pic->description}'><img src='{$pic->size(85,85)->url}' alt='{$page->name} photo' /></a></li>\n"; } Multiple images (if present) will get outputed. And this if it's in a repeater. We need to add another foreach wrapping the previous example. foreach($page->get("product") as $item) { // $item is now an entry from $page->product (repeater) // too access the images we now iterate $item->my_pics (images) foreach($item->my_pics as $img) { // $img is and image from $page->my_pics (inside repeater) echo "<div><a class='nowandthen'><img src='{$img->url}' alt='{$img->description}'>"; } } This cycles all repeater elements (if any) and output each image from the my_pics field. Now, if the image field is set to max "1" in the field setting, so you can only upload 1 image. The whole would look different as there's no foreach needed. But image field still work the same. //$page->my_pic is now only singular so no foreach needed as it's not an array echo "<li><a href='{$page->my_pic->url}' class='pic' title='{$page->my_pic->description}'><img src='{$page->my_pic->size(85,85)->url}' alt='{$page->my_pic->name} photo' /></a></li>\n"; Now the same in a repeater (product). BTW instead of $page->get("product") you can also just use $page->product, which is the same. foreach($page->product as $item) { echo "<div><a class='nowandthen'><img src='{$item->my_pic->url}' alt='{$item->my_pic->description}'>"; } One more. If the image field is again multiple >1 or 0 max files. You can also without foreach loop accessing one fromt he array directly. That's where ->first() comes into play. This also should be possible to use on repeaters to get the first repeater element from an array. Or it also can be used on Page arrays. foreach($page->product as $item) { echo "<div><a class='nowandthen'><img src='{$item->my_pics->first()->url}' alt='{$item->my_pic->firs()->description}'>"; } I'm not sure if that does make something clear for you. Let us know if still something unclear.
-
I'm using repeaters and images and didn't notice anything different from images outside repeaters. I just tested to see if multiple images works. Everything works like a charm. // my single image field foreach($page->teasers as $teaser) { if(count($teaser->image)) echo "<img src='{$teaser->image->size(0,100)->url}'/>"; } // changed to multiple foreach($page->teasers as $teaser) { if(count($teaser->images)) echo "<img src='{$teaser->images->first()->size(0,100)->url}'/>"; } Images get rendered as it should.
-
The image field is well documented http://processwire.com/api/fieldtypes/images/, and it's not different in a repeater.
-
I think that's one thing Ryan wanted to simplify. Look in the original repater thread
-
Memory size limit – works for me, not for client
Soma replied to yellowled's topic in General Support
That's the line where it tries to create a png image. -
Memory size limit – works for me, not for client
Soma replied to yellowled's topic in General Support
Only reasonable to me seems there must be something client side that gets appended from the computer while uploading the file, on server it is too big or corrupt that will throw a memory (so he could be infected by some strange alien source maybe) Is client uploading using drag and drop, can he try oldscool and see if it works? Can you send me an image? -
That's what I meant basicly. Just not the ugly ['foo'] thing. Well what I see is it doesn't solve the problems many unexperienced have they use the single image but they have a multiple image field. And one can even think if I only upload only 1 image it can't be an array. Edit: Well behind the scenes it's already always an array no matter what max setting is, just the value is treated differently on pages outputFormatting (page context) I think.
-
ProcessWire Conference 2013 / London / Cambridge
Soma replied to ryan's topic in News & Announcements
Word.. what? -
What changed should be made I'm not sure, I just fear, having it always return array even if it's only one image, will cause the same problem at the end. I can't find the post from Ryan, but I can find 10000 times a post where this was the issue. I think there's no way around having work both ways with single image anyway to maintain backward compatibility. Remember the issue here with digitexs example is simply about not understanding it is an array, even if it's a singe image uploaded. Imagine it will work with the original code and then upload a second image, it will be hard to understand why it suddenly doesn't work if understanding it's an array arrays is not so obvious. What about also throwing an explaining error notice if used the wrong way?
-
Cough cough, I've already heard that from Ryan!
-
Memory size limit – works for me, not for client
Soma replied to yellowled's topic in General Support
Just a random guess, as it can be many things. He's uploading an .png image but with .jpg ending? Another idea, can you access your clients computer remotely? Or maybe he's able to open a developer tool in his browser and take a look at if an error occurs on the ajax request (if it's ajax uploaded). Oh, and there was an issue once where someone tried to upload images from a cloud directory or app, I think it turned out to be the problem. Anything is possible here. Good luck! Master of edits: Isn't he really trying to upload a 10mb jpg ro something very large? -
Change sort order of Images Field in the backend
Soma replied to glebster's topic in API & Templates
Welcome! This is not currently possible if I remember correctly. You have to drag it (move) to first position after uploading. If you hover the colored bar of the item on the far right side you see and "to top", "top bottom" buttons that can be handy to move from bottom to top. -
I think you just don't get it! If you're image field has a max of 2! images, the field returns an ARRAY, EVEN IF only 1 images is uploaded. So you have to threat it as an array. Hence the example of using $item->product_shot->first()->url. Will return the url of the first image in stack, EVEN IF there's only 1 image uploaded. You can also use $item->product_shot->eq(1)->url; to retrieve the second one. And so on. Hope that helps