siteaddict Posted September 26, 2014 Share Posted September 26, 2014 Hi I'm new to processwire and the forum. so far i'm really impressed i have asked a few questions while i was playing around and the answers were spot on. Intro --- (skip if you dont want to read the boring i'm a newbie background stuff lol....) I just wanted to introduce myself and get some advise about a project i need to do. I'm not a designer or developer as to speak(but i plan to be in the future for little projects i do myself).I know html and css and thats about it. I have built a few wordpress sites using a few different methods but not in the development sense. Where I'm at ---- I own a offline business and the site at present and its based on wordpress but its really restricted to what i can do and the site has to have some complex things added for more functionallity . I could pay someone to do it but that takes the fun and knowledge out of one of the most essential tools to my business the website ! The problem is i have no php knowledge (except <?php ?>) or javascript etc and i need to get on this asap. But i'm willing to Learn The Project Ok the site is a battery site it needs to have the following functions added 1 The ability for customer to search for batteries by manufacturer etc 2 The ability for customers to search for batteries by car ie vauxhall astra petrol 2007 etc ( and when it pulls the results of the vehicle it needs to list the batteries and their details (make, battery type etc) there could be one or multuple batteries available for that particular model of vehicle i believe that it would be 2 separate functions on the site so customers can choose to search by batteries or vehicles 3 The ability to allow customers to search for their nearest loaction and be able to input a postcode area and have the results display whether we cover that area or not 4 A office location directory ( shown on a map also) 5 A Staff Directory 6 A blog 7 forms that can redirect on completion 8 Abilty to insert reviews etc 9 Twitter feed The question Can this all be achieved with processwire and where would i start ? TIA Ray Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted September 26, 2014 Share Posted September 26, 2014 (edited) Quick answer - all of that can be done in PW. You should start thinking out your data structure: what templates do you need, how are they interconnected. There is a good forum post by kongondo here somewhere about it. Hope someone will help me out on that... Here it is. Edited September 26, 2014 by Ivan Gretsky 2 Link to comment Share on other sites More sharing options...
totoff Posted September 26, 2014 Share Posted September 26, 2014 Can this all be achieved with processwire and where would i start ? Yes, it can and PW is the best tool for it. But it is an intermediate if not advanced task. You should have a look at the Scyscrapers Profile by Ryan to get a first approach. In addition, there are plenty threads in the forum dealing with similar topics from which you can learn more about how to do it. Another example from my mind ist this topic: https://processwire.com/talk/topic/7511-greggorrautocom-bootstrap-design/ However, you may want to make yourself familiar with the basics and come back with more specific questions. 2 Link to comment Share on other sites More sharing options...
pwired Posted September 26, 2014 Share Posted September 26, 2014 Can this all be achieved with processwire and where would i start ? This has been asked many times before and has been answered many times by experienced people on the forum. Search with {google + pw} 1 Link to comment Share on other sites More sharing options...
siteaddict Posted September 26, 2014 Author Share Posted September 26, 2014 Thanks Ivan In my attempt to get familiar with processwire ... this is what i did to try an accomplish something along those lines i set up pages as follows Car Batteries ( For all batteries) ... Varta .....Blue ........Battery type 075 ...Bosch ....S4 ........Battery Type 075 Battery Manufactures (for back end input select when entering data) ....Varta .....Blue ....Black .....Silver ......Bosch ....S4 ....S3 Cars --- (used to list models for front end) --- Audi -----A3 ----- models ----Alfa Romes ------33 Sportwagon ----- models Car Maufacturer and models ( for use in back end for select when entering data) --Audi ---A3 ---A4 --Alfa Romeo ---33 Sportwagon etc Am i going down right path ? Link to comment Share on other sites More sharing options...
siteaddict Posted September 26, 2014 Author Share Posted September 26, 2014 This has been asked many times before and has been answered many times by experienced people on the forum. Search with {google + pw} I appreciate that pwired but maybe its me but some of docs etc just confuse me and the training is a little on light side, but that's just from a newbies point of view trying to get into it and get started. Not that i'm saying its anthing to do with processwre maybe its just how i try to learn Link to comment Share on other sites More sharing options...
diogo Posted September 26, 2014 Share Posted September 26, 2014 Thanks Ivan In my attempt to get familiar with processwire ... this is what i did to try an accomplish something along those lines i set up pages as follows Car Batteries ( For all batteries) ... Varta .....Blue ........Battery type 075 ...Bosch ....S4 ........Battery Type 075 Battery Manufactures (for back end input select when entering data) ....Varta .....Blue ....Black .....Silver ......Bosch ....S4 ....S3 Cars --- (used to list models for front end) --- Audi -----A3 ----- models ----Alfa Romes ------33 Sportwagon ----- models Car Maufacturer and models ( for use in back end for select when entering data) --Audi ---A3 ---A4 --Alfa Romeo ---33 Sportwagon etc Am i going down right path ? Don't repeat data, connect it. I don't have time to go deeper than this now, but the post that Ivan linked to is very clear and easy to follow, give it a read and you will understand what I mean. 2 Link to comment Share on other sites More sharing options...
siteaddict Posted September 26, 2014 Author Share Posted September 26, 2014 Thanks for the feedback Link to comment Share on other sites More sharing options...
siteaddict Posted October 3, 2014 Author Share Posted October 3, 2014 Hi Guys the information and links you supplied really help but i have come against and issue i cant seem to get my head round. I have built my back end template and the issue i am having is i have a drop down linked to pages for the battery image battery images --->exide --->lion and the fields attached to the templates (1) Title (2) Images when you enter template you can select the pages exide or lion but how do i get the image related to the selected field template display in the main site template The reason i have done a separate pages for each battery image is that it so going 3-5 images that relate to multiply batterys inputed so i dont have to repeate up loading the images to each entry i have looked thorough the forum but cant seem to get there ive try'd <?php echo "image src='$pages=BatteryPictures->images->url'>"?> Link to comment Share on other sites More sharing options...
diogo Posted October 3, 2014 Share Posted October 3, 2014 Have a look here https://processwire.com/api/fieldtypes/images/ What you are doing is completely different 2 Link to comment Share on other sites More sharing options...
siteaddict Posted October 3, 2014 Author Share Posted October 3, 2014 Thanks diogo i did orginally go thorough that page ive manged to get a parcial url i just cant seem to get the file this is the url i get http://mysite/site/BatteryPicture/duracell-starter/ but i cant get the file name http://mysite/site/BatteryPicture/duracell-starter/duracellstarter.jpg my code is <?php if($page->BatteryPicture) echo "<img src='{$page->BatteryPicture->url}'>" ?> i cant seem to output the extual image file name the template is BatteryPicture and the image field name is battImage Link to comment Share on other sites More sharing options...
kongondo Posted October 3, 2014 Share Posted October 3, 2014 Just curious why you need the image file name? I think you can get that using echo $page->BatteryPicture->name. If what you want is an image caption, then give your images description and echo those out with echo $page->BatterPicture->description. Both code here assume you are referring to the image on the page that is currently being viewed. 1 Link to comment Share on other sites More sharing options...
diogo Posted October 3, 2014 Share Posted October 3, 2014 @kongondo, he is saying that the image name is missing in the URL, not that he wants specifically the file name. my code is <?php if($page->BatteryPicture) echo "<img src='{$page->BatteryPicture->url}'>" ?> i cant seem to output the extual image file name the template is BatteryPicture and the image field name is battImage So, apparently you are calling the template instead of the image field, try this instead: <?php if($page->battImage->url) echo "<img src='{$page->battImage->url}'>" ?> But make sure that you have this image field set to single image or set to image limit = 0 in the field settings, as that's the only way you can call the url directly on it. Otherwise you will have to iterate it (foreach) of call $page->battImage->first()->url instead. 1 Link to comment Share on other sites More sharing options...
siteaddict Posted October 3, 2014 Author Share Posted October 3, 2014 hi kongondo , not sure is the answer i'm trying to get my head round it . The site will have around 30-40 batteries each that belong to a different range (1 of 3) rather than uploading the image every time i made a field on the entry form that someone can select the image page thats associated with that entry. so far i have sorted that bit now i am building the template for the output i have my normal fields outputting as required . i just want it to grab the image from the BatteryPicture template image field thats associated with the entry and display it maybe i'm doing all wrong ? Link to comment Share on other sites More sharing options...
siteaddict Posted October 3, 2014 Author Share Posted October 3, 2014 @kongondo, he is saying that the image name is missing in the URL, not that he wants specifically the file name. So, apparently you are calling the template instead of the image field, try this instead: <?php if($page->battImage->url) echo "<img src='{$page->battImage->url}'>" ?> But make sure that you have this image field set to single image or set to image limit = 0 in the field settings, as that's the only way you can call the url directly on it. Otherwise you will have to iterate it (foreach) of call $page->battImage->first()->url instead. Thanks diogo i try'd and didnt work My template for the batteries is battery-template (for entry and display) the field on the entry is BatteryPictures which links to the pages ->home ->Battery-Images ---->DuracellStarter (fields are title and battImage) using a template called battery-images Link to comment Share on other sites More sharing options...
diogo Posted October 3, 2014 Share Posted October 3, 2014 (edited) Hm, I think you are making some confusion with the notion of template. The template hold the fields in abstract, you can't get a field from it, instead, you get the fields from pages that have a specific template. hi kongondo , not sure is the answer i'm trying to get my head round it . The site will have around 30-40 batteries each that belong to a different range (1 of 3) rather than uploading the image every time i made a field on the entry form that someone can select the image page thats associated with that entry. so far i have sorted that bit now i am building the template for the output i have my normal fields outputting as required . i just want it to grab the image from the BatteryPicture template image field thats associated with the entry and display it What's the name of the page field that holds the image? If I understood well, you have to grab that field, and then the image. Assuming that the page field allows for multiple pages, you can grab the image like this (meanwhile I saw your last answer, so the names should be correct) <?php foreach ($page->BatteryPictures as $pic) { if($pic->battImage->url) echo "<img src='{$pic->battImage->url}'>"; } Edited October 3, 2014 by diogo corrected typo 1 Link to comment Share on other sites More sharing options...
siteaddict Posted October 3, 2014 Author Share Posted October 3, 2014 Hm, I think you are making some confusion with the notion of template. The template hold the fields in abstract, you can't get a field from it, instead, you get the fields from pages that have a specific template. What's the name of the page field that holds the image? If I understood well, you have to grab that field, and then the image. Assuming that the page field allows for multiple pages, you can grab the image like this (meanwhile I saw your last answer, so the names should be correct) <?php foreach ($page->BatteryPictures as $pic) { if($pic->battImage->url) echo "<img src='{$pic->battImage->url}'>" } Thank you i try'd your code but it chucked me an error Parse Error: syntax error, unexpected '}', expecting ',' or ';' (line 15 of /var/sites/e/eworldsales.co.uk/public_html/site/templates/DuracellStarter.php) This error message was shown because you are logged in as a Superuser. Error has been logged. there is only one image on field i have set =0 Parse Error: syntax error, unexpected '}', expecting ',' or ';' (line 15 of /var/sites/e/eworldsales.co.uk/public_html/site/templates/DuracellStarter.php) This error message was shown because you are logged in as a Superuser. Error has been logged. Link to comment Share on other sites More sharing options...
adrian Posted October 3, 2014 Share Posted October 3, 2014 It's missing a semi-colon at the end of the if($pic .... line. 1 Link to comment Share on other sites More sharing options...
diogo Posted October 3, 2014 Share Posted October 3, 2014 Sorry, wrote that on the browser. Already corrected. 1 Link to comment Share on other sites More sharing options...
siteaddict Posted October 4, 2014 Author Share Posted October 4, 2014 Thanks guys for your help i still cant get it to work tho ... must be something i'm doing wrong . Back to the drawing board Link to comment Share on other sites More sharing options...
kongondo Posted October 4, 2014 Share Posted October 4, 2014 To be honest, I have read this a couple of times (as well as Diogo's explanation) but I still don't get what you are trying to achieve . I am not even sure whether we are talking backend or frontend. Maybe a diagram? Then again, I am just slow that way . Or if possible, set up a free 7-day dummy/test ProcessWire website on lightning.pw that we can have visualise....Just a thought... 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now