-
Posts
2,862 -
Joined
-
Last visited
-
Days Won
47
Everything posted by Joss
-
Yeah, that was the bit I just realised Just for interest, how can I put $page->title in the function brackets without breaking them? Like function localSidebarText($page->title) or do I have to always convert them first?
-
ignore me, I think I have worked it out
-
What is the path to an uploaded image in an "Image FieldType"?
Joss replied to n0sleeves's topic in Getting Started
Oh, I should add a couple of other bits! If you set your image file so it can only have one image, then you can treat it as a single result as I just did above. However, if you set it for more than one image (or any number by leaving it set at 0) then it will produce an array. So you will need to treat it as such and either loop through the images or just grab the first: Read this post by Ryan (or God, as we know him) http://processwire.com/talk/topic/81-images/- 11 replies
-
- 1
-
-
- image location
- img src
-
(and 1 more)
Tagged with:
-
What is the path to an uploaded image in an "Image FieldType"?
Joss replied to n0sleeves's topic in Getting Started
Hi and welcome! $page->col1Image->url Is what you are after. That will come complete with the path. And you are welcome to keep asking questions here without feeling daft - every body does and everybody tries to answer them too! Joss- 11 replies
-
- 1
-
-
- image location
- img src
-
(and 1 more)
Tagged with:
-
There are times when I think I am going mad. I have been trying to get a very simple function to work, but I am having trouble passing a variable. So I have simplified the function to the point of silly but it still does not work. All I have in it is a word and a variable - the variable is from outside the function. I have tried: $firstline = "please say"; function localSidebarText($firstline) { echo $firstline; echo "hello"; } localSidebarText(); and I have tried: $firstline = "please say"; function localSidebarText() { global $firstline; echo $firstline; echo "hello"; } localSidebarText(); And all it outputs is the word "Hello" What am I doing wrong? Joss (who is having a really bad night when it comes to anything PW/php shaped)
-
Er .... is this a problem with 2.3? I have just noticed that I don't have this problem on a system running 2.2.12 on the same box. EDIT: I mean, the difference between 2.2.1.2 and 2.2.1.3
-
ummm not sure what you mean .... (remember, me not a programmer!)
-
er, so how do I get round that? Since this error is on the module upload itself. Interestingly, when it says There is no thumb called ... there is no name after the word called. I checked directory permissions, by the way, and they seem okay. The images field is uploading fine.
-
Nope The dev box is Ubunto server with webmin/virtualmin installed. Recent versions of apache, php - all installed as standard.
-
I have just tried with a different crop image on another installation on the same box, and it is the same problem. Normal images work fine. So it must be something that crop image needs in apache that I haven't got? I am guessing wildly!
-
Hi Soma No it was a crop image to start with. All pretty normal stuff to be honest - haven't done anything clever
-
Hi apeisa Yep, three different thumbnails, commas in the right places. I have used this loads. I just checked with another installation on the same box and it is the same problem - but I don't get it on my production server. So it has to be something with my local box - but damned if I know what.
-
I have just run into an issue with Thumbnails which has to be an issue with my Dev box, but I am not sure what. Basically, if I try and upload an image, it doesn't work - the name of the image appears, crossed out with the red X symbol and a notice that says "there is no thumb called:" The standard image field works fine. What should I be looking for? Joss
-
Hi pwusr Basically it is much as Soma said a couple of posts up. You create your menu/site structure using pages that represent categories (as Ryan has said before, because of the page structure of PW, they can be seen as a hierarchical category structure) But then you need to add products to each of these categories. You can either make those child pages of the categories, or you can store them completely separately and add a Page field to them to select your "category" For example. Create a page field (call it category) Set it to the third option - single - on the details tab. On the input tab, set Home as the parent (remembering all your categories are going to be children of the home page) and set the template as what ever your category template is. At the end of the input tab, set the field type to "select" - you don't need anything more clever. Now, add this field to your product template. Now, when you create a product you can use this page field to select a "category" Those product pages can be stored anywhere. However, you probably don't want them to appear on the main menu - you just want your category pages and any info pages there. So, create a template called "product-list" that has no file. Once you have saved that, go to the Family tab and where it says "Allowed templates for children" choose you product template. Go to pages and create a new page under Home. Choose the product-list template. Save and then under settings make sure this page is Published and Hidden. Now, any children of this page will not display on the main menu. So you can create all your products as children here. You can leave them as one long list, or split them up into manageable sub levels - up to you. It wont affect what is displayed on the front of the site since it is the category pages field that will do that job. On your category template, you can now use the $pages->find (see cheat sheet) to bring up all the pages that have the template "product" and where their category pages field matches the current page, and then loop through them. The final result is that the structure of the front end of the site is based around the category pages and how you have organised those, and the products are simply displayed because of the category they are related to. As you can imagine, using the same principle, you can associate your pages in all kinds of ways - using tags, is a good example. Sorry if I wasn't clear before - hopefully this is better! Joss
-
Soma, How can you work you way down the category tree to get a list of all the categories in one branch, starting from the current category page? I have suggested above that this should be used to get a list of the category page IDs and then to use that list to retrieve all products for the current category AND the sub categories (however far that tree extends) In that way, the category tree works as a filter as well as a logical structure. I agree about the product tree - not needed for the site to work, though it can be useful to just sort stuff out in the backend. But that structure can be ignored.
-
Hi If I follow your picture story right, you are able to add more than one category to any one product? I think you have gone slightly more complicated than I would have done. The product Hierarchy is good for keeping things sorted in the back end, but I would not have necessarily used it in the front end, but rather just used the category structure to sort the products. This might be overly simple for what you want. It depends how you want to have your products. Try this: Category 1 -- Category 1 1 --- Category 111 If you want to display just the products that appear in each category (and only that level), then you just need to get those products whose category field matches the current page. (I suggest matching by ID if possible so any name changes to categories does not cause problems.) However, you could also work down the list so that on the Category 1 page you show products related to Category 1, Category 1 1, and Category 1 1 1, On the category 11 page, you show products relating to category 1 1, and category 1 1 1. Since category 1 1 1 has no children, you would only need to filter by just the current page. Now, I admit I don't know how to code this, but effective you just need to recursively find all the child and sub-child (and so on) categories of the current category page and then match that array of categories to the product category field. (the starting point to do this is probably in the sitemap template, by the way) Each product would only need to belong to one category - you are effectively making it a member of parent categories, if they exist. You would only need the one category template this way to cover all your categories; you can test whether there are any child categories and if not, just use the current category. If that has no products either, then display something that says "no one here but us child categories!" - well, make it nicer than that! Does that help, or am I making it more confused?
-
Yep I get a lot of errors though. My dreams appear to be missing a debugger. Working on it.
-
Just for interest, I have just finished the cartkeeper site. You can read about it here complete with before and after shots: http://stonywebsites.co.uk/news-articles/stony-company-get-website-facelift/
-
On the principle that I have just been doing a template for a site that has 12,000 categories (!), the way I would do this is to list categories as pages under the menu but then create products separately, probably listed under a hidden parent called "products" or something nice! Then create a page field for your product template called "category" and set it to only list pages that have the "category" template. Now, when you create a product you can link it to one of your category pages - at any level. In theory this means that each category can have both products and sub-categories. Now, with your category template file, you need to do two things: 1. Check to see whether there are any children to the page (and if so, list them) 2. Check to see if there are any product pages where their "category" page field = the current page. And if so, list them. Design wise, you could put products in the main area and shove sub-categories (children) in the side bar or something sweet like that. You could also add another grouping called Manufacturers (create those under a hidden page as with the products) And throw those into the mix too. I suggest a large piece of paper and a pencil! Joss
-
Ah, yes, now that I can see that you were having a completely different conversation, it makes perfect sense!
-
You can sort of do a workaround as Diogo said by adding an "addClass" to the template, then using a text field to say what the actual class is - but this is a bit eye-bending and I think it helps with images that when you are doing the "insert image" action, that is the point you are asked awkward questions and not somewhere else on the form. I get your point about not making it too confusing. In an ideal world, you would have a button that said "press this if you want a big version to open in a lightbox" and the rest is done automatically. But, as you say, that means that the WHAT is done automatically and so needs to be set earlier; probably in the image field configuration, giving the dev enough options for their particular dancing image popup system. Of course, that would also lay the ground work for some of the other future image settings
-
Yes, there is no gallery that comes with PW, basically because it is so easy to create one in any shape you wish. Phillip has shown the most obvious method. Make sure that your image field is set to however many images you want (0 for unlimited or put a fixed number in there to limit users so they dont go mad). Then you can output them either as a straight list of images, as Philip has done, or dig around for a nice JQuery plugin to do interesting stuff with. For instance, this is one I did using Flexslider (I think). http://pwdemo1.stonywebsites.co.uk/galleries/devon/ On this one I also used the Thumbnails images module rather than the normal images as it allowed me to mess around with cropping the thumbnail if I needed. I also used a repeater field so that I could add a TinyMCE field for doing the captions rather than just the images description field. But essentially the theory is as Philip mapped out for you.
-
Hi Nico I think your module might solve a problem I have - but I am not sure. Would I be able to create a simple gallery (just a foreach loop round an image field) and then use your module so that the user can decide where in their text they want the gallery? And what is the best way to do this? Obviously, I know how to do the gallery bit, it was how I can create the shortcode. All the best Joss
-
Installation error: Unknown MySQL server host 'Config'
Joss replied to sbarner's topic in Getting Started
Also, check your port for mysql -
How to package a site to install it on another machine?
Joss replied to demhan's topic in Getting Started
The profile exporter will create an SQL file and package up all your files. You can then run an install with a fresh copy of PW with your archived files - full instructions are with the module and it walks you through it. Otherwise, you can easily just move the entire PW directory over to a server, export your own SQL, and then just change the database settings in config. One note, whichever you do, if you are adding images via TinyMCE, it saves the path to the image folder. If you are developing in a subdirectory, that will be part of the path. You can do a search/replace within the database to change this later, but what can be easier is to make sure the development set up is the same as the final production site. (Especially if two of you are working on the same thing!)