Jump to content

Joss

PW-Moderators
  • Posts

    2,862
  • Joined

  • Last visited

  • Days Won

    47

Community Answers

  1. Joss's post in Accordion Tabs as Pages or Repeater? was marked as the answer   
    Er, not totally sure what you mean here.  But there are several routes.
    You could use Repeaters, especially the updated repeaters on the PW 3 branch (and look out for the forthcoming matrix repeaters which would be very powerful)
    You could use page table, which is similar, but you get to choose where the pages are stored - eg, under the parent that holds all the tabs, or under another parent that is, perhaps, hidden so that that part of the tree does not appear on navigation.
    You could use a page field so that the client is free to choose pages from wherever you stipulate on the tree.
    I am not sure what you mean about the ckeditor, but I haven't used repeaters for a while as I have been using page table.
    When it comes to creating tabs or accordions, then surely you only create them out of the available published and un-hidden pages? So, there will be not tab available to be clicked on, if you see what I mean.
  2. Joss's post in Array Chunk problem was marked as the answer   
    Solved - I needed to tell it what it was:
    $testimonials = $pages->get("/")->testimonials; $testcount = $testimonials->count(); $resultnum = ceil($testcount / 2); echo $resultnum; foreach(array_chunk($testimonials->getArray(), $resultnum) as $list){ echo "<div class='block block12 '>"; echo "<p>hello column</p>"; foreach($list as $test){ echo "<p class='quote'>{$test->text}helo</p>"; echo "<p class='from'>{$test->from}</p>"; } //end inner foreach echo "</div>"; } So, added getArray
    Thanks to this little post as a clue from Netcarver
    https://processwire.com/talk/topic/7803-implement-array-chunk/?p=75573

    Aww! You beat me to it, LostKobrakai
  3. Joss's post in Forged, again was marked as the answer   
    Clever chap!
    There was around 30 characters of white space between the very front of the file and the <?php
    removing that did it.
    How would that have effected it?
    EDIT: I had tried turning off CRSF protection already, but it made no difference, other than adding the header problem
  4. Joss's post in Get image from multiple pages based on current page selection was marked as the answer   
    Make sure the image field is set to 1 image only, otherwise it will be an array.
    You have taken the right route to get to the image field, though you don't really need to set up a separate $rating variable.
    $page->classification->image_field, and then add ->url to output the url
    echo "<img src='{$page->classification->image_field->url}' alt='{$page->classification->title}'>";
  5. Joss's post in Dual themes site was marked as the answer   
    Template files, by default, need to be in the templates directory, not a subdirectory. But that does not mean you cannot include files from other directories.
    I don't know what design differences you will make, but assuming that you have detected what device you are on (kiosk or other would be the best starting point), then just serve up the portion of the template that you need.
    You could either use php to include another page (which could be in any directory for your organisational purposes - there is no technical reason for it to be anywhere particular) or just divide the page up and serve up only a portion.
    For simplicity, I would probably go for the first.
    So, for the home page, for instance, you have a template called home.php
    The only code in this template would effectively say
    <?php // some detection stuff resulting in getting a $kiosk value - I have no idea what! if($kiosk){ include(./kiosk/home.inc); } else { include(./web/home.inc); All your templates would basically have the same code. 
    The .inc files would then contain everything your normal template file would.
    Something like that.
  6. Joss's post in Unidentified Script? was marked as the answer   
    Are you using email obfuscation?
    That script is the email obfuscator doing its job.
  7. Joss's post in Debugging Load Delay - Where to start was marked as the answer   
    The quickest way to check the page weight is to stop rendering the images.
    One thing I had with PIM the other day (the first time I had used it) was that in its default configuration, the images it was producing had a significantly higher file size than the originals, despite being smaller pixel wise. This was because it was saving at a much higher quality than I had saved the originals.
    Then again, you only have 12 images here.
    I am not sure if you are also overworking your code a bit (this is the point when Soma might tell you that I am talking rubbish - he knows WAY more than I do)
    Just digging out a similar bit of code from an old blog of mine:
    function getPostsbyCategory() { $thisCategory = wire("page"); $posts = wire("pages")->find("post_category_select=$thisCategory"); $out =" "; foreach ($posts as $post) { $text = implode(' ',array_slice(str_word_count($post->summary,1),0,$maxpostlength)); $out .="<div class='posts clearfix'>"; $out .="<a href='{$thisCategory->url}{$post->name}'><h4>{$post->title}</h4></a>"; $out .="$text...<a href='{$thisCategory->url}{$post->name}'>read more</a>"; $out .="</div>"; } echo $out; } Ignore me truncating the text in the middle.
    I don't appeared to have explicitly referenced the title field, but I cant remember why. I have left out any limits or pagination here.
  8. Joss's post in Reno Theme Not working Properly after upgrading to 2.5.2 was marked as the answer   
    Make sure the theme is selected for the users.
  9. Joss's post in mind boggling Foundation conflict was marked as the answer   
    Okay, solved it.
    But something must have changed in Dev that I have missed.
    Basically, I forgot to check if the image existed before outputting it. (Embarrassing since I make a big thing about that on my tutorials!)
    Normally, this would scream a huge great error at you, but for some reason it didn't.
    Because the basic-page is rendering two child pages (currently) and the second one did not have an image, that threw a server error which impacted on the foundation aside code, though I really don't know how.
    Putting the check to make sure the field had an image in it solved the problem.
  10. Joss's post in Responsive Images was marked as the answer   
    I have to admit that I don't really take into account those who have javascript disabled (around 0.2%)
    I suspect that figure is misleading as it will include all those who disable for some ideological reason - from the marketing point of view, that grouping are not a very responsive target market for most clients
    Still, it is not as bad as one site I visited a few years ago - the site would not deliver the page I wanted because "I was using an OS by the devil Gates"
    I wonder how long that chaps face has been missing a nose.....
  11. Joss's post in Include nanospell in TinyMCE was marked as the answer   
    Are you sure the version of the plugin you are installing is compatible with this version of TinyMCE?
  12. Joss's post in Image description was marked as the answer   
    If you set your image field to allow a maximum of 1 image, then you can treat it as a single value.
    However, if you have it set for more than one image, it is automatically an array, even if there is only 1 image in it.
    If it is an array, you then have to tell it which image in the array you actually want - for instance using first - just like any other array in PHP.
    However, normally you would allow more than 1 because you want to loop through them, for a gallery, for instance.
    If you only want 1 image, I suggest you edit the field and set the max number of images to 1, just to save confusion.
  13. Joss's post in Drupal's View like Module was marked as the answer   
    Obviously, the pages page on the admin also does exactly that, though for all pages.
    If you are using the dev version there is a lister module as part of the core (I think)
    https://processwire.com/talk/topic/5835-lister/?hl=lister
    This allows you to create lists of pages based on set criteria
    Remember, that if you are creating roles, the users will only be able to see pages in the admin what you want them to see.
    When you create templates, you can also restrict who their parent is and what templates can be used for children, or even if they can have children at all - see the Family tab on a template.
    You can also create an "Add New" button on the Pages page. If you look at the family tab on a template, you will see instructions for adding that template to the Add New button - the button will automatically appear if one or more templates are set up in the right way.
  14. Joss's post in Getting image from search page was marked as the answer   
    To start with, last should be last() (I think)
    So $img = $m->images->last()->width(200);   Then you need to get the url for the image   <img src='{$img->url}' />   The URL contains all the path data.
  15. Joss's post in Need help blocking a crawler was marked as the answer   
    This might help
    https://support.krystal.co.uk/entries/24933152-How-to-block-bad-spiders-from-wasting-bandwidth-
    Also if your client is going via Cloudflare, you can block bots there before they get anywhere near the server.
  16. Joss's post in Can I do this with Processwire? was marked as the answer   
    Well, I imagine anything is possible!
    I have never used the multisite functionality, so you will have to see what that offers, but I suspect that you can do a little bit of re-routing so that if they login to their-site.com/admin they get sent to your-site.com/admin.
    That is not uncommon with that sort of set up, to be honest.
  17. Joss's post in How to make a site with different Themes? was marked as the answer   
    Actually, if you want to control some bits and pieces, you can simply create a hidden page with a template (without a template file) and call it something like settings.
    You could add a field, for instance, called site_title, and then call that field into perhaps your header of the site:
    <title><?=$pages->get("/settings/")->site_title ?></title> You could put other global bits in there like a name to call a theme css file and that sort of thing.
    Don't need a module for that. I always create a page like that with global bits and pieces in it and then just call the fields into which ever template files.
  18. Joss's post in Just installed locally and have some questions was marked as the answer   
    Welcome!
    Two little questions that have rather large answers, to be honest.
    First of all, I suggest that you ignore front end for the moment till you get your head round the rest of the process (see what I did there?)
    The key to ProcessWire is the incredibly powerful APi which allows you to build any functionality - Form Builder is a module that allows you to create front end forms very easily, but they can also be built manually.
    So, I suggest you do one or other of the tutorials in the Wiki just to get the hang of how the system works and as a very basic introduction to the API
    http://wiki.processwire.com/index.php/Main_Page
    Next step is to look at the API (linked on the top menu) and especially the Cheat Sheet. 
    http://cheatsheet.processwire.com/
    That will give you a clue to how much is possible with ProcessWire.
    The point with PW is that it is not quite an out-of-the-box solution like the Drumlapress mob, but it allows you a lot more versatility and does not shoehorn you into one particular way of working.
    Having said that, it is not a scarily complicated system either - many of us started using it with very little development knowledge, but have found it manageable and we have learned a huge amount.
    And had fun in the process.(I did it again..!")
    So, get your hands dirty with the tutorials and then ask any specific questions you need - you will find the people on the forums here are, quite uniquely, rather better than boring old docs!
  19. Joss's post in Change the admin path was marked as the answer   
    Yep!
    Admin, just like everything else, is a page.
    So, if you click on Admin on the pages list, edit and then go to settings, you will see you can change the name (and therefore the path) just like any other page.
    You will need to log back in after, and don't forget what you changed it to!
  20. Joss's post in troubles with sort was marked as the answer   
    try:
    sort=-created
    to use "date" you would need to have created a filed called Date, I think.
  21. Joss's post in Varying field descriptions was marked as the answer   
    WHen you add a field to a template (and save the template), click on the field name and it will open a pop up where you can specify required, label, description and width.
  22. Joss's post in $page->title alias was marked as the answer   
    You can change the label of any field for a particular template. Just edit the template, click on the field name to open the modal pop up and change the label for the field - it will only affect that template.
    Scrub that - I misread your post
    The problem is that until you have told the system which template to use, it does not know what to call the field.
    Hiowever, if the parent page's template only allows one template for children, then it does know and the alias will be displayed when you create the page.
×
×
  • Create New...