encho Posted November 12, 2012 Share Posted November 12, 2012 Completely new to this cms, would like to know would you recommend PW for online magazine style website? Main features would be that texts (articles) would have short and long version where long version would be available for subscribers only. So basically if you are subscribed, you would see full version of the article. Also needs to feature PDF downloads (subscribers only), etc. Articles should be sorted by issue no, but also categorised and tagged. Would this CMS be sufficient or should I look elsewhere? Thanks for all the comments. Link to comment Share on other sites More sharing options...
Adam Kiss Posted November 12, 2012 Share Posted November 12, 2012 Hey encho, welcome to the forums. Categories, tags: no problem subscribers-only articles: certainly not a problem, even though this will contain some custom programming PDF downloads: doable, even though you'll have to provide this functionality by yourself (either by some CLI programs, or sending data to some service) Hope this helps. 1 Link to comment Share on other sites More sharing options...
encho Posted November 12, 2012 Author Share Posted November 12, 2012 Hey encho, welcome to the forums. Categories, tags: no problem subscribers-only articles: certainly not a problem, even though this will contain some custom programming PDF downloads: doable, even though you'll have to provide this functionality by yourself (either by some CLI programs, or sending data to some service) Hope this helps. Thanks for your reply. By custom programming, would you mean using the existing stuff, or building a new module? Link to comment Share on other sites More sharing options...
Adam Kiss Posted November 12, 2012 Share Posted November 12, 2012 either do it with module, or any other way possible with PW. And by that I mean, that PW will probably provide you with something like user management, but the rest will have to be handled by you (unless there already is module for something like 'read more' or such, which is entirely possible). 1 Link to comment Share on other sites More sharing options...
apeisa Posted November 12, 2012 Share Posted November 12, 2012 "Custom coding" might be as simple as this: <?php if ($user->hasRole('subscriber')) { echo $page->body; } else { echo "<p>To read full document, you need to login (or register)</p>"; echo $page->shortContent; } 2 Link to comment Share on other sites More sharing options...
ryan Posted November 12, 2012 Share Posted November 12, 2012 Here's an example of a site with [some] subscriber-only content that's running on ProcessWire: http://www.di.net/ Example of subscriber article: http://www.di.net/ar...king_long_view/ Nice job to the guys that made it! (was not me) 1 Link to comment Share on other sites More sharing options...
encho Posted November 13, 2012 Author Share Posted November 13, 2012 Wow, thanks a lot guys. Getting to know this cms/fw and it is far more advanced than I thought it would be. Going to spend some time getting to know it, it really seems it is worth the efforts. But I would need help/pointer where to start exactly, there doesn't seem to be any user manual or quick start guide, does it? Link to comment Share on other sites More sharing options...
arjen Posted November 13, 2012 Share Posted November 13, 2012 You can download Processwire (including the default profile) or the blog profile. Those are really good starting points. 1 Link to comment Share on other sites More sharing options...
onjegolders Posted November 13, 2012 Share Posted November 13, 2012 Wow, thanks a lot guys. Getting to know this cms/fw and it is far more advanced than I thought it would be. Going to spend some time getting to know it, it really seems it is worth the efforts. But I would need help/pointer where to start exactly, there doesn't seem to be any user manual or quick start guide, does it? I recommend taking a look at the API http://www.processwire.com/api/ and running through all the great information there. For a complete rundown on everything you can do in a template, try Soma's cheatsheet http://www.processwi...api/cheatsheet/ For everything you said you had to do, I think PW would be a great fit, it doesn't even sound that custom to me. Tags and categories would be just their own pages and link to articles using a page reference field. Short/long versions is easy, in your template you'll just check if the user is logged in eg: if ($user->isLoggedin()) { // show long version echo $page->body; } else { // show teaser echo $page->summary; } For PDFs, are you uploading them yourself? If so, it's just a case of adding a file field to your template and then linking to it/them. PW sounds like a perfect fit to me. If you need any help with code, just ask. 2 Link to comment Share on other sites More sharing options...
encho Posted November 13, 2012 Author Share Posted November 13, 2012 Thanks, feel really overwhelmed now. In default template there is a nice list of children pages underneath the body text. foreach($page->children as $child) { echo "<li><p><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>{$child->summary}</span></p>"</li>; ... } I want to include resized children images as well, but no luck. Including: echo "<img src='{$child->images->url}{$child->images}' alt='' />"; Upper code works, but displays full resolution images. Any attempt to do resized images fails, where am I wrong? echo "<img src='{$child->images->url}{$child->images->size(232, 176)}' alt='' />"; Link to comment Share on other sites More sharing options...
diogo Posted November 13, 2012 Share Posted November 13, 2012 What you want is the url of the resized image. replace your code by this: echo "<img src='{$child->images->size(232, 176)->url}' alt='' />"; 1 Link to comment Share on other sites More sharing options...
apeisa Posted November 13, 2012 Share Posted November 13, 2012 And if images allows more than one image, the working code would be: (show only first image) echo "<img src='{$child->images->first()->size(232, 176)->url}' alt='' />"; (show all images) foreach($child->images as $image) { echo "<img src='{$image->size(232, 176)->url}' alt='' />"; } 1 Link to comment Share on other sites More sharing options...
encho Posted November 13, 2012 Author Share Posted November 13, 2012 Thanks, it is obvious now Decision has been made, I will do my new magazine website with ProcessWire, great response from the community made my decision easier. Two things left to try: how to handle tags/categories (is autocomplete available as an option anywhere), and how to handle PDF downloads (just as file attachments to posts, with possible access control). Anyone had any experience in transferring large Drupal site? 1 Link to comment Share on other sites More sharing options...
diogo Posted November 13, 2012 Share Posted November 13, 2012 This answer from Soma on another thread may be useful concerning the question about the tags http://processwire.com/talk/topic/2010-fieldtype-for-storing-tags/#anonymous_element_10 For the PDFs you just have to put a files field on your templates for uploading the PDFs, and link to it like stated above: if ($user->isLoggedin()) { echo "You can <a href='{$page->file->url}'>download the file</a> now."; } else { echo "Please log in to download the file." } Anyone had any experience in transferring large Drupal site? There is a already a tutorial for this http://processwire.com/talk/topic/1015-switching-from-drupal-to-processwire/page__hl__drupal 1 Link to comment Share on other sites More sharing options...
encho Posted November 13, 2012 Author Share Posted November 13, 2012 This answer from Soma on another thread may be useful concerning the question about the tags http://processwire.c...mous_element_10 For the PDFs you just have to put a files field on your templates for uploading the PDFs, and link to it like stated above: if ($user->isLoggedin()) { echo "You can <a href='{$page->file->url}'>download the file</a> now."; } else { echo "Please log in to download the file." } There is a already a tutorial for this http://processwire.c...age__hl__drupal Thanks! One more question (now I am being too pushy), in the example above how to formulate the code so it won't run if the image in the subpage doesn't exist, as it is producing an error for subpages without an image attached. echo "<img src='{$child->images->first()->size(232, 176)->url}' alt='' />"; Link to comment Share on other sites More sharing options...
onjegolders Posted November 14, 2012 Share Posted November 14, 2012 Depends on the context. What's the subpage? Do you mean check if any of the subpages contain any images? If so, you could do something like this: <?php $sub_images = $page->children()->images; if ($user->isLoggedin() && count($sub_images)) { foreach ($sub_images as $image) { ?> <img src="<?php echo $image->url" /> <?php } } 1 Link to comment Share on other sites More sharing options...
encho Posted November 14, 2012 Author Share Posted November 14, 2012 Sorry I was not clear enough. From the above suggestions, my final code placed below bodycopy looks like this: foreach($page->children as $child) { echo "<li><div style='float:right;'><img style='margin:5px 0 5px 5px;' src='{$child->images->first()->size(232, 176)->url}' alt='' /></div>"; echo "<div><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>{$child->summary}</span></div></li>"; } So in case child has an image as part of the page, there is no problem. But if it doesn't exist, the above code will produce an error. I would like to set the condition which will ignore the first 'echo' line if the image is not present. Link to comment Share on other sites More sharing options...
apeisa Posted November 14, 2012 Share Posted November 14, 2012 <?php if ($child->images) { // We have images } // You can also check the count if ($child->images->count() > 1) { // We have more than one image } 3 Link to comment Share on other sites More sharing options...
onjegolders Posted November 14, 2012 Share Posted November 14, 2012 As Apeisa says, within your foreach loop, you'll need an if statement so: foreach ($page->children() as $child) { if (count($child->images)) { echo "<li><div style='float:right;'><img style='margin:5px 0 5px 5px;' src='{$child->images->first()->size(232, 176)->url}' alt='' /></div>"; } echo "<div><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>{$child->summary}</span></div></li>"; } EDIT: Need to "count" to see if their are images 2 Link to comment Share on other sites More sharing options...
encho Posted November 15, 2012 Author Share Posted November 15, 2012 So simple! I am used to overcomplicate things thanks to my experiences with other CMS's. Thanks. 4 Link to comment Share on other sites More sharing options...
encho Posted November 16, 2012 Author Share Posted November 16, 2012 So my final code looks like this: if($page->path != '/' && $page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { echo "<li>"; if (count($child->images)) { echo "<div style='float:right;'><img style='margin:5px 0 5px 5px;' src='{$child->images->first()->size(100, 100)->url}' alt='' /></div>"; } echo "<div><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>"; if ($child->summary){ echo preg_replace('/\s+?(\S+)?$/', '', substr($child->summary, 0, 251))."…"; } else echo strip_tags(preg_replace('/\s+?(\S+)?$/', '', substr($child->body, 0, 251)))."…"; echo "</span></div></li>"; } echo "</ul>"; } Very nice list limited to 250 characters per item (but not relevant to my question ). How to paginate the output, as I have more than 100 items per list? Pagination module takes variable and splits it into pages, but how to define one here as I was using 'foreach'? Thanks! Link to comment Share on other sites More sharing options...
apeisa Posted November 16, 2012 Share Posted November 16, 2012 $results = $page->children("limit=25"); ... now loop the results ... echo $results->renderPager(); 2 Link to comment Share on other sites More sharing options...
ryan Posted November 17, 2012 Share Posted November 17, 2012 Also, don't forget to enable page numbers for your template (Setup > Templates > your-template > URLs > Page Numbers). 2 Link to comment Share on other sites More sharing options...
encho Posted November 18, 2012 Author Share Posted November 18, 2012 Tested this and in 'normal' form it works, ie <?php $results = $pages->find("id>1, limit=10, sort=title"); echo $results->render(); But in my example above doesn't. Although it displays the pager, when I set the limit to 25 it displays 4 pages, with limit 10 displays 10 pages. Meaning it picks up the total number of items, but does not separate them in pages, displaying all of the 100 items regardles of the page you click. What is wrong with the code? Link to comment Share on other sites More sharing options...
apeisa Posted November 18, 2012 Share Posted November 18, 2012 Can you paste full code you have now? 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