jtborger Posted June 20, 2013 Share Posted June 20, 2013 Hi, First, some introduction... I'm new on PW, just started yesterday evening and I'm very enthousiastic! I have 10 years+ enterprise experience in PHP (owning my own software company for 8 years). I have developed an enterprise CMS myself for lawyers, accountants and all sort of enterprise users which focusses towards handbooks (ISO and the likes) which is used by 2000+ companies (incl. government) in The Netherlands. Besides this, I just do some websites for friends and family in my spare time (which I do not have because I'm a dad of 3 too). I stumbled upon PW yesterday after I (again) completely freaked out at Joomla. I know this software when it was called Mambo 4.5.2 and I have created many componenents for it, knowing it from the inside. I always (after the first 3 months) hated it, but you know, when developing a small website it was the tool at hand for me because I knew it so well. And just every time I created a website I got frustrated, but well I got there and "OK, next". But this week, after 4 days of trying and reading and CCK extensions modules overrides custom layouts and all this stuff which makes me sick because its inconsistent as hell, I decided to just QUIT on joomla. It makes me cry. No joy in developing a small website. It's always about fitting in their model instead of the other way around. (And somehow, WP (which I don't know) feels the same way but different) Having said all this, did I mention I am very enthousiastic about PW? Well, I am. I have created in just one day (or half a day) what I wanted to do with Joomla and couldn't do it in four days. Even while I didn't got any sleep last night due to 5 weeks old baby etcetera. So, I'm happy with PW. Very happy. It just delivers. And I'm not familiar with the jQuery syntax (mostly used Mootools in my own software). It is just intuitive. I hope I stay this enthousiastic. But I'll gain some trust every step I make with it. Of course, there are a few things which I don't get directly, but I can search and read. But I wanted to just introduce myself and say a big THANKS for PW to Ryan and all the others. There is something I don't really grasp yet. Like this: I have several news items. These items are linked to from products. This works very nice But of course I want to have an index of all the news items. I can make a news-index template, and just make one. No problem. And then, I have a several review items, and several quotes. And I want them linked to products, no problem. But have an index too. Now, I can make 3 index pages. But somehow, they are similar to each other. Thus, Why don't create a 'polymorph' 'index' template. Which refers to a certain template (like, news, reviews, quotes) and loades all the items. Somehow, I just didn't came across this idea in the docs, wiki or forum. Perhaps I didn't read good enough, and I'm the first to admit I did not spent too much time with PW, but I'm curious if these kinds of concepts are 'the PW way to do things'. Another question/thought I have is about the data model. But thats maybe not the right place to ask right now....Is there something I can read about the thoughts and concept of the datamodel? Thanks in advance, I hope to use PW for my upcoming website projects and just want to finish my first stuff in the following weeks.. So you'll possibly see me some more on this forum. Ow by the way just one point of feedback: when doing my research yesterday, I thought that there were only video's available to get to know PW. After a while I stumbled upon the wiki and getting started links ! Wow. That saved time. But I wonder: why isn't that on the homepage? Every developer just wants to know about this I guess... After all the horrible forums with joomla 'experts' a forum isn't the first place I go look for documentation and help, you see.. 5 Link to comment Share on other sites More sharing options...
kongondo Posted June 20, 2013 Share Posted June 20, 2013 Hi jtborger, Welcome to PW and to the forums! I don't have answers to your questions (at the moment); just stopping by to say hello. I can assure you you have made the right choice in choosing PW (or at least in ditching Joomla! ). Happy developing with PW! Link to comment Share on other sites More sharing options...
Soma Posted June 20, 2013 Share Posted June 20, 2013 Welcome! Just quick. Theres plenty of template settings to use. If you want to share template files you can define alternative template filename under advance d tab. So you can have multiple share same file. Link to comment Share on other sites More sharing options...
MarcC Posted June 20, 2013 Share Posted June 20, 2013 What Soma says--use the alternate template filename option. Don't write the same code twice if possible. You can use PHP logic to then detect a template name inside that file and call specific functions as a result. after 4 days of trying and reading and CCK extensions modules overrides custom layouts Oh man, that tweaked my stomach a bit. This year I finally removed the last K2 (similar to CCK) markup from a Joomla site I had converted to PW. I hated to rewrite all the CSS but the markup was driving me nuts. However, it's important to keep in mind that if you try hard enough, you can make the same mess in ProcessWire. Watch the forums for Ryan's tips, because he seems to strike a good balance between "simple to maintain" and "tailored for the client". Link to comment Share on other sites More sharing options...
jtborger Posted June 20, 2013 Author Share Posted June 20, 2013 Hi, Thanks for the replies. I'll try the alt-template filename. Still though you get an index template (no file, ok) for each index. Although PW is very flexible, I feel it is (or should be?) a little bit opinionated about how to solve these things. But I'll try and wait for more replies Just as MarcC says: However, it's important to keep in mind that if you try hard enough, you can make the same mess in ProcessWire. And I'm fully aware of that. It's just the struggle of these kinds of systems. The good thing of PW is you make the mess yourself and it is a constistent mess, at least down to the core. Which aint the way with J****A... Link to comment Share on other sites More sharing options...
apeisa Posted June 20, 2013 Share Posted June 20, 2013 I have built pretty complex sites with PW and I remember feeling ankward of having similar template file per listing page. I thought that I would use alt-template filename all the time, but haven't actually used that much. And I don't see myself using it much in future neither... After revisiting sites after year or so, I love the fact that when I want to extend something, I always know the "starting point" (consistently named template file). And important to notice: having separate template file for each of your "index templates" doesn't mean you have to do any code duplication. Includes, modules, functions... what ever suits your workflow best Oh and welcome! You will definitely enjoy PW! 4 Link to comment Share on other sites More sharing options...
jtborger Posted June 20, 2013 Author Share Posted June 20, 2013 Hi, Thanks. Perhaps I just have to get used to it. That will be a factor of great importance I'd like just to do it right the first time. And like efficiency And important to notice: having separate template file for each of your "index templates" doesn't mean you have to do any code duplication. Includes, modules, functions... what ever suits your workflow best I see what you mean, but there I think it gets 'dangerous'... It's something I wonder all the time: it seems that PW encourage it to indeed, use includes, and thus build your own library to use in your websites. Which is great. For me. But for someone else, when he is doing maintenance? I mean, certainly I profit from have some abstraction so I'll keep things DRY etcetera. But because there seems no real standard place or way to do that, isn't that some 'weakness' of the platform? And adoption by lets say enterprise or government? Don't know if that is the ambition, but I just wondered...Which doesn't mean that other platforms/CMSes dont suffer from the same stuff. But the more rigid it is... You get it. To put it the other way around: it is perhaps the most strong part of PW that it is so open, yet it might be the most weak part too, if you see what I mean? But I'll get my hands (more) dirty first before bringing up such issues seriously.. Link to comment Share on other sites More sharing options...
apeisa Posted June 20, 2013 Share Posted June 20, 2013 You are right. If PW would have lots of conventions, default support for same frontend framework (and therefore lots of generated markup), it would mean that sites build by different companies would be closer to each other. But philosophy behind PW is way different: pretty much zero assumptions, just super useful tool that you can use how you best see. It means you can use all the experience you have (php coding, front end stuff etc) and build upon those skills and processes that you already know. 1 Link to comment Share on other sites More sharing options...
kongondo Posted June 20, 2013 Share Posted June 20, 2013 Once you have gotten your hands dirty enough, you will want to read this classic (if you haven't seen it already) http://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ 1 Link to comment Share on other sites More sharing options...
ryan Posted June 22, 2013 Share Posted June 22, 2013 Beyond being a CMF/CMS, the goal of ProcessWire has also been to provide utility to PHP like jQuery does to Javascript. That means we accept PHP best practices as our best practices, rather than inventing proprietary, usually more complex and short lived alternates that do the same thing. It also means using very simple, yet tried and true PHP like functions and includes for code reuse rather than snippets, blocks, chunkers, snaggers, widgets, tagalongs, bangers or whatever concepts are being pushed out there. ProcessWire provides tons of structure when you want it to, and gets out of your way when you want it to as well. For me it means template files that rarely have much code in them (occasionally none), unless the output need is different from the rest of the site. Most of the site's markup gets generated either from a "main" output file, or from shared render functions. As a result, most template files tend to have limited or no markup and look like the example at the bottom of this post. It also means that I don't usually have more than 2-3 other PHP files, beyond the template files. See the template file structure section of this post for details on how I structure my template files–I've found this method to work best for me through several sites. The delegate approach and some of the others I've seen don't suit my needs as well, but seem to work very well for others. The Blog profile uses an MVC style approach that may appeal to those looking for lots of predefined structure, though I still prefer approaches that involve fewer files. For small stuff, the approach taken in the default profile (included with ProcessWire) is about as simple as it gets, even if it's not as elegant. But when it suits the need, I don't see any reason to shy away from it. Regardless of how you structure your site, the important thing is to aim for DRY (don't repeater yourself). home.php $body = renderSlideshow($page->features) . $page->body; $side = renderNews($pages->find("template=news, sort=-created, limit=5")); The example above uses the /site/config.php 'prependTemplateFile' and 'appendTemplateFile' options to include an _init.php (prepend) file that initializes variables like $body and $side with defaults, and a _main.php (append) file that outputs them in the predefined places within the context of an entire HTML file. The template files get executed in between those two and modify $body and $side as needed specific to the data and needs of the template and page. 3 Link to comment Share on other sites More sharing options...
jtborger Posted June 25, 2013 Author Share Posted June 25, 2013 It also means using very simple, yet tried and true PHP like functions and includes for code reuse rather than snippets, blocks, chunkers, snaggers, widgets, tagalongs, bangers or whatever concepts are being pushed out there. ProcessWire provides tons of structure when you want it to, and gets out of your way when you want it to as well. That is is a great choice I think and I have to get more experience on how to make the most use of what PW offers. Its true that the concept of PW is easy to find and that there is nothing hidden beyond the surface with all kinda those widget thingies which you must know before you can use them etc. The only reason I brought this up was I was wondering what the main design decisions were. For me it means template files that rarely have much code in them (occasionally none), unless the output need is different from the rest of the site. Most of the site's markup gets generated either from a "main" output file, or from shared render functions. As a result, most template files tend to have limited or no markup and look like the example at the bottom of this post. It also means that I don't usually have more than 2-3 other PHP files, beyond the template files. I read the topic you mention and I understand how that approach can differ from a very basic '5 page website' approach. I just have to develop my own 'toolbox' for this approach (because I used MVC structures of those other frameworks (Zend and own brew stuff) and adapt it for PW use. What I wonder is how PW will stand up against 'IT managers departments' when it comes to proven technology and maintenance since PW doesn't offer guidelines for the structure and thus one doesn't know what he buys when he buys a website built with PW. Could be anything, from spaghetti to truly awesome OO, extensible and maintainable code. But for me as a developer, it's a good approach and possibly the best out there. because you can adhere your own style of coding and managing things. Which gives you a flying start. But I hope that PW gets accepted for larger companies too. Thanks for pointing me to the prependTemplateFile and appendTemplateFile variables. I just started a bit early with coding and skipping the config.php and without studying the skycrapers demo in detail. Thanks Ryan for your detailed reply and for all your work to ProcessWire and the community! 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