Jump to content

Joss

PW-Moderators
  • Posts

    2,870
  • Joined

  • Last visited

  • Days Won

    47

Everything posted by Joss

  1. Trust you to beat me to it!
  2. Okay, so we all like to think we are super organised when it comes to planning our ProcessWire site, but sometimes life is not like - we are uselessly lazy and can't even make our coffee in the right order (is is add the whisky first or second?). So, here are a couple of really lazy ideas to make everyone feel better about messing up. First Lazy idea Oh, I forgot to create a field! (or two, or three....) On the template edit page where you add the fields, how about a Create New Field button that allows you to create a field and add it to that template. Probably opens a modal window to create the field. Second Lazy Idea OH, why didn't I create the field BEFORE I created all these templates? No Problemo! On the field Info tab where you can see which templates use the field, what about having another box that lists all the templates that do NOT use the field and are displayed in columns with little check boxes next to them - tick the boxes and save to add the field to those templates. Third Lazy idea Adding a group of fields to a group of templates. I have actually just changed this from what I was going to suggest because my original idea was not lazy enough - far too much work for the user. So, you get a new button at the bottom of your list of fields and a check box next to each field. Hit the check box and the button gives you the option to Add fields to Template. A modal opens where you can change the order of the fields and select which templates you want to add them to. In addition, you get the option to add them within a tab set or field set and give that a name. Click Add and all those fields are added to the templates in the order you have set them. (Note, if any of the fields have already been added to any of the templates, then it either does not add those fields and tells you which were not added to which templates, or it fails completely and tells you which were not and so on.) Fourth Lazy Idea Lazy blokes template creation with fields. So, you suddenly realise you need 20 more templates with 18 existing fields each but you haven't got a handy dummy template with the right fields in. Don't panic. On the new template screen, simply select the fields you want, complete with tabs, field sets, and the right order, then choose the templates you want to create as normal and done! Wow, that was lazy! Fifth Lazy Idea I can't remember what I am doing where, why and when! So, this is a new screen under set up called something like Field Matrix. Basically it is a large, scrollable chart that has fields down the Left and templates across the top. From this chart you can now see which fields are being used on which templates shown by ticks and crosses. PLUS! You can actually add and remove fields from templates by clicking on their tick or cross to change it. THIS IS REALLY DANGEROUS (and probably a bad idea) but it is also wonderfully lazy! Doesn't all that laziness feel good? So there you go: Five lazy ideas to help tired, overworked, and disorganised web people get through their day, Joss (I know, far too many changes in one go - but I enjoyed thinking about them!)
  3. Hi Felix I get fed up of liking your showcase posts - you keep doing really nice websites! Can you do a terrible one so I don't feel forced to like it?
  4. There is an up and downside as an input field. The up is that conflicts should be non-existent. The down is that you cannot add it to an existing field. Maybe there is a way to do it where it targets very specific fields rather than just hitting all textareas. That way it might also play with text fields as well? (is that possible?) for instance when you want to limit a title length.
  5. That might explain why it is happening in my front end form. I have tried that edit and it seems to work. I haven't checked thoroughly whether it causes any other issues in the process, though I cant think what problems it would cause. boundaryfunctions - you should be able to check those yourself okay because it is not a question of having form builder installed. Thanks guys!
  6. That's because you are one of the good guys!
  7. Nope - it is just throwing that error when I use formbuilder. It is when debug is on. When you save a form that includes a textarea, you get the error and when you use the form in the front end I also get the error. But this is happening simply because the counter module is installed on the system, not because I have tried to include it in a form. Ryan's comment is here: https://processwire.com/talk/topic/2343-char-counter-for-texttextarea-fields/?p=22901
  8. I wasn't sure it had been changed - I noticed a post from Ryan a couple of pages back about making it compatible. I am not actually trying to use it with formbuilder at all - it is just generating the error all on its own
  9. How to get round problems with form builder with this module? It is throwing errors both on saving a form and when I submit the form on the site - though the form is working. Notice: Trying to get property of non-object in /home/claysvehiclerepairs/public_html/site/modules/TextareaCounter/TextareaCounter.module on line 50 Notice: Trying to get property of non-object in /home/claysvehiclerepairs/public_html/site/modules/TextareaCounter/TextareaCounter.module on line 58 Notice: Trying to get property of non-object in /home/claysvehiclerepairs/public_html/site/modules/TextareaCounter/TextareaCounter.module on line 66 Thanks!
  10. Hi Dazzyweb I think that often depends on what the competition does. With music, I would love to charge for demos and then do some discounting on the final version. The trouble is that none of my competitors do that and so I would quickly lose business. It is right pain actually - I spend a huge amount of hours each year doing demos that come to nothing.
  11. Okay, just add complication... On some pages I have a select that just selects a block, so: $block = wire("page")->block_single_select; Those dont have a problem. On other pages, they are getting their blocks from a central setting: $block = wire("pages")->get("/servicing/")->block_single_select_manufacturers; Those fail unless I turn them into multi and call them like: $block = wire("pages")->get("/servicing/")->block_single_select_manufacturers->first(); That works. ########### part of the problem here is this was meant to be a very simple site and has become very complicated. I will write a case study called: "How to over complicate a solution and end up building a site that is worth far more than the client will actually be paying"
  12. Okay, I have found a solution. If I make it a multi field, but use just a single select drop down and then change my Get to include first() it works. So, as long as its part of a wirearray I am okay. Makes me want to shudder! I had the same problem with another version of the field that is in a different part of the system - it did the same thing, but was set for a different list.
  13. Actually, it is even more odd than that. I cant link to anything in the same branch of the tree. However, the other group of block, which are a multiselect field and therefore are within a foreach, have no problems
  14. Well, I changed the link and it all went away... So, I dont know.
  15. SOLVED IT - er, I think The problem is that if the block link is pointing to the same page as the block is being displayed on, then it fails - which is why I was getting a 500. So, I am going to have to work out a check here of some sort to see if $block->block_link->name is the same as the last bit of the url of the page. grief!
  16. Okay, it looks like I am all backwards on this. Sorry, tried so many variations I am getting lost. It appears to go wrong when there IS a link chose. Actually, there seems to be some problem with $block->block_link->url all on its own.
  17. This also does not work: if(!($block->block_link instanceof NullPage) ){ }
  18. No, still gives me a 500
  19. er ,,,,,, Its a Null Page single (well, you only get a page at a wedding so if you are single you haven't got one in the first place) I have tried with both. Mind you, haven't tried isset with boolean false... yet.
  20. @interrobang Nope. This is how the entire thing works. Have a page field used for selecting a single block That is fine. The block template has a page field for selecting a link to a particular other page. I want it so that if a link is selected then a nice button shows. But if it isn't, nothing shows. The same code works fine inside a foreach loop for choosing multiple blocks, but fails when I use it to select just a single block with a single select. Here is the full code: function singleBlockServiceModels(){ $block = wire("pages")->get("/servicing/")->block_single_select_models; $color = $block->block_bgcolour; $rgba = hex2rgba($color, 0.5); $thisanchor = "#{$block->block_anchor}"; $out =""; $out .="<div class='columns block-container sinlge-block' style='background-color:{$rgba};' data-equalizer-watch>"; if($block->block_show_headline){ $out .="<div class='block-header'>"; $out .="<h4 class='text-center'>{$block->block_headline}</h4>"; $out .="</div>"; } if($block->block_image){ $out .="<div class='block-image'>"; $out .="<img src='{$block->block_image->url}' alt='{$block->block_image->description}'>"; $out .="</div>"; } $out .="<div class='block-body'>"; $out .="{$block->block_text}"; $out .="</div>"; if($block->block_link->url){ $out .="<div class='block-link text-center'>"; $out .="<a href='{$block->block_link->url}{$thisanchor}' class='readmore-button '>Find Out More</a>"; $out .="</div>"; } $out .="</div>"; // column echo $out; } Oh, the rest of it works if I remove the if statement at line 23 onwards
  21. Single (I am not a morman)
  22. UPDATE: I have now changed the title of the post because the situation got more confused and the problem worked out differently. The problem has not been solved, and there is a better breakdown of the issue here: https://processwire.com/talk/topic/8231-check-if-page-field-is-set/?p=80520 ###################### Original post: I have no idea what is wrong with my brain today. I am using a page field to generate a link in a block. If a page is not selected, I dont want to show the linking markup. So, how do I check whether it has been set or not? Just doing if($block->page_field) throws an internal server error. if(isset doesn't seem to do anything. nor does if(empty so... ? Help! EDIT: This is not in a loop, by the way
  23. Patron Saint of Firefighters and soapmakers http://en.wikipedia.org/wiki/Saint_Florian Always said you were wonderfully saintly, Soma!
  24. On the other hand, you could ignore Foundation entirely and go for something like Pocketgrid.
×
×
  • Create New...