Jump to content

Joss

PW-Moderators
  • Posts

    2,862
  • Joined

  • Last visited

  • Days Won

    47

Everything posted by Joss

  1. The most obvious thing is to use a foreach loop to loop through your news items. Look up selectors in the API and create a $pages->find() select statement to select your news articles and then loop through them using a standard php foreach statement. If you limit the select to, perhaps, the most recent 5 articles, then that will be shown automatically every time a new article is added. There you go - I have been really mean and left all kinds of information out, but there should be enough there to get you started!
  2. Well, he had to have had ONE good day..... @cstevensjr You have been having fun! I approve....
  3. This is not a distro, just a tutorial and definitely not for a production. I would not want to advise on security without serious expertise. As an old friend of mine who really knows what he is doing has pointed out many times, there are a lot of tutorials out there about security written by people who should be shot. (He is subtle like that) I think I will avoid joining that list!
  4. Don't even go there! This is the one that ships with the most recent Ubuntu Its working now though
  5. Joss

    Muesli Café

    Love the concept. I haven't any spare cache, but if you want any thing cooking/serving wise, let me know. Send me more info and I will put it on my food blog, however http://foodloversdiary.com EDIT: hahaha - I mean CASH, not cache!
  6. Okay, ignore me.... GD wasn't installed. Damn, I thought I had done that too.
  7. Hi Horst Got a little problem. I have just upgraded my server to apache 2.4 and, more importantly, php 5.5.9 On one dev site I am suddenly getting the following error - it was fine on the old server and older version of php: Error: Call to undefined function imagecreatefromstring() (line 837 of /home/sanglier/public_html/site/modules/PageImageManipulator/ImageManipulator.class.php) What do you reckon?
  8. It strikes me that there are two levels to this. The first is an obvious one. When you create a new page via a pagefield, either the page is opened in a modal ready for editing, or there is a link next to its listing in the page field that allows it to be opened in a modal. I can think of advantages to both. The other one is less obvious and that is the relationship between the the pages listed in the page field and the page that contains the page field. It could be argued that in some circumstances that one is an extension of the other and that maybe there might even be some symbiotic relationship. The most obvious one is with assets like images. If the page field is listing Categories, for example, and the categories have images (category logo/icon, maybe some other images like textures and so on) then when you choose a category for an article, maybe those assets should become available to the article (I know you can browse your way backwards through the system, but I mean more obviously available). There may be other inheritance options available that can be included programmatically and are accessible or optional from the included page/pages too. And being symbiotic, they would work in both directions too. I am not sure where that idea is going, to be honest, but it is just a feeling that this could be taken further as an option.
  9. I just had a panic as I reinstalled one of my virtuals only to get a 500 error. Then, as I went through it, I realised that of all the backups I could have picked, I picked the one with a typo. Typical!
  10. Well, I am eventually up and running, I hope. The result of my labours is here: https://processwire.com/talk/topic/7890-tutorial-setting-up-an-ubuntu-dev-server-with-virtualmin/
  11. IMPORTANT - DO NOT USE THIS FOR A PRODUCTION SERVER This is not strictly a ProcessWire tutorial, except it really is very useful for developing ProcessWire websites. I have just rebuilt my little dev server and it was a right pain - basically, I made the mistake of following a couple of bits of really bad advice. I eventually nailed down the right thing to do in the right order from about three different sources and have decided to write it up. This tutorial will take you through installing a pristine, new version of Ubuntu on an old PC, setting it up to work on your local network (this is NOT a publicly facing server), installing Virtualmin, Samba window shares, and setting up your first virtual server. The main problem I found with the help that I followed, is that no one seemed to link all these install processes together - so a standard install of Ubuntu with Apache would completely mess up Virtualmin and make it all a nightmare. This is a PDF file without screenshots, but to be honest, I am not sure how screenshots of command line is particularly helpful to anyone! Feel free to use this and let me know if it actually worked. NOTE: I am not a sysadmin, so if you find strange errors, you are more likely to find the answer through Google than by asking me - this is just the result of me pulling my hair out for a day or so. I certainly cannot guarantee that this is perfect or even the best way. Installing Ubuntu and Webmin.pdf
  12. When I rewrite my old simple site tutorial, I will be recommending the blank install and then I will take the most logical route so that the html is really staring people in the face. If the HTML is recognisable and familiar, they will have a better chance of understanding what they need to learn. However, I will, as I have done before, make sure that new users realise that this is not what you MUST do, but rather what you CAN do. The problem with tutorials, as with demo installs, is that you have to decide on just one method to avoid confusion - it is difficult to avoid newcomers believing that this is the way they have to do things.
  13. There are days where I get a huge great, miserable reminder than I am a composer/writer/advertising bloke, and not a sysadmin, coder or expert anything. Warning: if some bright spark has a solution for this, don't tell me - its too late. Having had a couple of odd problems I decided that I really ought to update php on my little Ubuntu dev box. It is 12.04 with Webmin installed. Turns out that this is not very easy to do - generally, the Ubuntu repositories only let you install the php that comes with your distribution - 12.04 only comes with 5.3. However, I found a neat little tutorial that added a repository so that you can upgrade - it is maintained by some of the debian folk. So, I went and did that. Trouble is, it also went and updated Apache to 2.4 (much to my surprise) and everything went wrong. First of all, Apache wouldn't start. It was complaining about everything. I spent 2 hours reading posts from everywhere and nothing worked. So, I uninstalled it, purged it and reinstalled it. Yep, it started! Except now, it would not recognise ANY of the virtual hosts. I started reading again. I tried creating new hosts in Virtualmin, but Apache did not want to know. I tried manually - still not interested. I read every post out there and tried every trick - but the things they said would be definitely wrong were fine, except the working thing. I tried a couple of other things which included restarting apache. Guess what? It wouldn't start again - gave off the same errors. I had backed up all my sites with Virtualmin, so I tried restoring them to see if I could force it to work. Nothing. So, I have found myself staring at a development server that isn't - serving that is. And, what is more, my meagre knowledge has simply run out, as has my patience. So, I have just double backed up everything - files, MySQL and the rest and I have just downloaded a new ISO of Ubuntu. And with that, I am going to reinstall the entire thing, format all the crap away into PBS Telethon, sort out some partitioning woes I had in the process (my old boot partition was too small, really) and start from scratch. It is not clever, it is not educational and it is a sledgehammer solution - but when you are not the Demon Sysadmin of Fleet Street, sledgehammers might be all you have left.
  14. I have to say that working within the templates directory, however you decide to do it, is hardly building a template engine. What really worries me about a lot of this is that there seems to be a fear of writing ordinary html with some css bunged in. However you decide to organise your structure, however you decide to piece the bits together, in the end, that is all you are doing.
  15. Yes, when you first create a page, it does not know what template you are using, unless you are only allowing it to use one template. So, any things you set on the template like the label of the title field will not show until you save the page.... er, obviously.
  16. There is a bit of SEO going on here too, or can be. So, for instance, the Full Name might be what you want to be displayed on the page, but its not what you want in the <title> tag or in the menu or in the URL. In that case, it actually may be beneficial to have separate fields. Of course, that might also send the client barmy and end up with them crying in the corner of the room in confusion, which might not be quite so desirable....
  17. Ah, very secret function.....
  18. You can include a file two ways. With CSS you can simply have a div that includes various markup and use display: none for media quieries where you don't want to see it. However, you can also use some ajax and load a page using jquery. So you would do something like: var $window = $(window); function checkWidth() { var viewportWidth = $window.width(); if(viewportWidth >= 1290) { load a page with ajax here } else { Load the same page with a different template here etc } } checkWidth(); // Bind event listener $(window).resize(checkWidth); }); So you can have a separate template for mobile layout and load that one or another depending on the viewport width. Warning: I am not a coder, so you will need to double check how to do this properly!
  19. Yeah, that damned mains plug in the wall - gets you every time... Good luck with the rest of the site!
  20. 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.
  21. Well, at least that means that your script structure is probably fine. Thinking back to the maintenance man in my old studio who used to shout to us to check the plug was in the wall before phoning him saying "its broke again," start going through the obvious. I am assuming that the categories are a group of pages under a set parent using the same parent. And you are using the title field to search by. To start with, the problem with using the title field is if you rename the category you might have an issue. So, just for interest, search by id instead. See if that is okay.
  22. What on earth are you calling that is doing that? just for an experiment, what happens to the page if you remove the query and its associated code completely? Just in case it is NOT the product query that is causing the problem
  23. Does that mean it is working now? By the way, unless there is a reason for everything to be up at the head, I would move your scripts to just before your </body> tag with the exception of modernizr. Also, is owl carousel.js included in responsee.js? Ow do you need to include it separately - I don't know responsee.
  24. Are you calling the owl slider? You should have this on your page somewhere: $(document).ready(function() { $("#owl-demo").owlCarousel(); }); It sounds like your loop is working fine, so this is not a PW problem but possible an issue with initialising the script and so on. Again, check the console in chrome to see if it is showing any JS errors.
  25. er... not knowing exactly what your set up here is, but it sounds like you are basically grabbing a huge amount of information and then trying to deal with it. But I cant see where that is happening. Now, your database query (find) it is looking for what exactly? The fact that you have used this script before sound like the problem may be in the quantity you are dealing with in this case, or something like that. In other words, not so much what you are returning but what you are searching. If the CPU usage is rocketing, then it sounds like you are getting stuck in a loop somewhere - searching on itself or something. Can you refine the search in anyway to make it more specific?
×
×
  • Create New...