craigiop Posted February 11, 2016 Share Posted February 11, 2016 Is it possible to create a new template solely through the CMS panel? Also, is it possible to copy an existing template and remove/add fields? So far my attempts have not been successful. Thanks in advance for my noob questions! Link to comment Share on other sites More sharing options...
pwired Posted February 11, 2016 Share Posted February 11, 2016 Is it possible to create a new template solely through the CMS panel? Yes you can create a template directly from within the processwire backend without a template file in the templates folder associated with. You can just the same add fields to such a template. Here is a thread that shows how flexible templates can be used in processwire: https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ 1 Link to comment Share on other sites More sharing options...
Peter Knight Posted February 11, 2016 Share Posted February 11, 2016 Yes, you can copy/duplicate a template. What problems are you having? 1 Link to comment Share on other sites More sharing options...
EyeDentify Posted February 11, 2016 Share Posted February 11, 2016 You can create so to speak an empty template without an uploaded template file by going to the Admin > setup > templates > add And not choose a template file. Then a empty template is created unless you choose to have fields included from another template. You can use this template When creating pages just like templates with files connected to them. Hope it helps. 1 Link to comment Share on other sites More sharing options...
craigiop Posted February 11, 2016 Author Share Posted February 11, 2016 Yes, you can copy/duplicate a template. What problems are you having? One issue is trying to rearrange the order of the fields in an existing template does not seem to produce the expected results. The order of the items in the template is not necessarily what renders when the page is viewed. Also, removing fields causes odd occurrences on the page (ie. some of the field elements are removed, but others persist). Any ideas? Link to comment Share on other sites More sharing options...
szabesz Posted February 11, 2016 Share Posted February 11, 2016 Hi craigiop, It sounds like you are you using "someone else's" site profile. Anyway, if you remove fields, you might need to adjust the appropriate template file(s) accordingly. 2 Link to comment Share on other sites More sharing options...
diogo Posted February 12, 2016 Share Posted February 12, 2016 Processwire is great and all, but not magic it won't guess what you want to do with the fields, so you have to tell it with code. You'll have to know at least some html and learn the API in order to do structural changes to your website or, in alternative, hire a developer. 1 Link to comment Share on other sites More sharing options...
kixe Posted February 12, 2016 Share Posted February 12, 2016 There are Trillions of ways to access your values in Processwire. To get what you expected create a simple template file like this one: <?php /** * return all populated string values in the order of fields as defined in template settings * * **/ $ul = ''; foreach ($page->fields as $field) { if (!$page->$field) continue; $ul .= '<li>'.$page->$field.'</li>'; } $ul = "<ul>$ul</ul>"; echo $ul; ?> Learn a bit PHP. Read some PW Tutorials. Stay with PW and get happy Link to comment Share on other sites More sharing options...
Peter Knight Posted February 12, 2016 Share Posted February 12, 2016 There are 2 sides to a template. There's the template within the Processwire backend. As a developer you add fields to this. The order of fields only affects editors when adding content. Usually the page title is first and you might have a field called Page Summary followed by Body and then Images etc. That same template as a php file lives in /site/templates too and is used to display data on the web (frontend). The order of the data /fields it displays is completely up to you as a developer and doesn't have to reflect the order which editors see. For example, you could have the Page a Title as the first part of the html page but then output images and then your Body Content data. They're completely independent. If you've inherited a site from someone else and wish to adjust the front end output, look for the php file and edit that. On a side note, things became a lot more interesting recently with a new Matrix type field but lets skip that for the moment. Also, removing fields causes odd occurrences on the page (ie. some of the field elements are removed, but others persist). Any ideas? I imagine your template is calling content from other pages and that's why you're seeing this. Templates can call content from a variety of sources. If you're removing fields and dismantling your templates, please make a backup of your site first Link to comment Share on other sites More sharing options...
craigiop Posted February 12, 2016 Author Share Posted February 12, 2016 There are 2 sides to a template. There's the template within the Processwire backend. As a developer you add fields to this. The order of fields only affects editors when adding content. Usually the page title is first and you might have a field called Page Summary followed by Body and then Images etc. That same template as a php file lives in /site/templates too and is used to display data on the web (frontend). The order of the data /fields it displays is completely up to you as a developer and doesn't have to reflect the order which editors see. For example, you could have the Page a Title as the first part of the html page but then output images and then your Body Content data. They're completely independent. If you've inherited a site from someone else and wish to adjust the front end output, look for the php file and edit that. On a side note, things became a lot more interesting recently with a new Matrix type field but lets skip that for the moment. I imagine your template is calling content from other pages and that's why you're seeing this. Templates can call content from a variety of sources. If you're removing fields and dismantling your templates, please make a backup of your site first Thanks every one for the replies! I am a front end designer, and currently do not have access to the PHP files (of which I only have limited working knowledge of). So if I understand this correctly, one simply can't change the order of the front end template without modifying the PHP template file? Link to comment Share on other sites More sharing options...
szabesz Posted February 12, 2016 Share Posted February 12, 2016 So if I understand this correctly, one simply can't change the order of the front end template without modifying the PHP template file? Generally speaking this is true. There can be cases when it is possible to change the order of "objects" on the frontend just by changing the order of pages or repeaters for example, but there aren't any standard ways of implementing features like this for the frontend, since ProcessWire does not dictate any sort of frontend "design patterns / rules". So it all depends on your template files / site profile. You need access to the PHP template files. 2 Link to comment Share on other sites More sharing options...
diogo Posted February 12, 2016 Share Posted February 12, 2016 Yes, you understand correctly. The reason for this is that ProcessWire was developed to make fine tuned websites, and it doesn't have any control over the markup (with exception to modules), so it all depends on the php code that was written. For a simple example: If you have a field called "phone", and another called "fax", in this order on the backend, you would probably have something like this on the template file: <p id="phone"><?=$page->phone?></p> <p id="fax"><?=$page->fax?></p> As you can see, in that case you only have php in between the <p> tags, and the fields are being called by their names, so changing their order on the admin won't make any difference. In the same way that deleting a field won't remove the surrounding <p> tags, and will probably throw an error since the system is explicitly looking for a field that isn't there. Because of this, PW offers you tools to give this flexibility to editors, like "repeater" fields, or the pro "multiplier" and "table" fields that would allow you to change the order in the admin page, but would have a very different code in the template file: <?php foreach($page->contacts as $contact){ echo "<p id='{$contact->name}'>{$contact->value}</p>" } Of course, all this would have to be accounted for while building the site. My advice is: try to get access to the PHP files, and you will most probably understand easily how to change what you want. 2 Link to comment Share on other sites More sharing options...
ROLAND_JUNO Posted August 14, 2017 Share Posted August 14, 2017 I am in the same boat here I was thrown this PW site from the company that developed it, I don't have access to the back-end and I am only a Front-End developer, so how am I supposed to get around with this website? I have tried reaching out to hire a developer but getting (you should do it like this.) Which makes absolutely no sense cause I can't manipulate the PHP from the backend? So if there is anyone willing to make a couple hundred bucks to help me put a couple of things on our website that would be great. Thanks Roland Link to comment Share on other sites More sharing options...
OLSA Posted August 15, 2017 Share Posted August 15, 2017 On 2/12/2016 at 1:00 AM, diogo said: Processwire is great and all, but not magic it won't guess what you want to do with the fields, so you have to tell it with code. You'll have to know at least some html and learn the API in order to do structural changes to your website or, in alternative, hire a developer. Bravo diogo! There is no option to give you 10+. Please don't be like others communities where is restricted to tell the true. Processwire is developer oriented platform and need to write code if you want to do custom things. Not like in Joomla or Wordress where you can install template and do things without coding, but also many of us here were there ( for years) but stay with Processwire. Regards. Link to comment Share on other sites More sharing options...
dr Dogma Posted June 14, 2020 Share Posted June 14, 2020 imnew to process wire , opload any template to process wire ? is necsary to convert to php before toit ? where you can see examples is any book or tutorial around ? ill appreciate comments regard Drdogma 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