Jump to content

PW for online magazine


encho
 Share

Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

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

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).

  • Like 1
Link to comment
Share on other sites

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

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.

  • Like 2
Link to comment
Share on other sites

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

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='' />";
}
  • Like 1
Link to comment
Share on other sites

Thanks, it is obvious now :rolleyes:

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?

  • Like 1
Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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

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 } 
}
  • Like 1
Link to comment
Share on other sites

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

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

  • Like 2
Link to comment
Share on other sites

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...