-
Posts
1,147 -
Joined
-
Last visited
-
Days Won
4
Everything posted by onjegolders
-
Thinking about building an "easy" site profile
onjegolders replied to statestreet's topic in Themes and Profiles
I'm currently trying to build a new profile but more for me than anyone else. I like the idea of having certain fields, templates and modules already installed as a starting point. Eg: a settings template with site_name, site_slogan, company_phone etc already built in. Modules like email obfuscator, analytics alreadt built in and maybe a couple of stylesheets so a new project can be up and running much faster. Any thoughts on what else to include? -
Thanks Adam, I'm trying to put the points forward and put PW's name out there! http://www.andregoldstein.co.uk/blog/why-more-often-than-not-i-use-processwire/
-
Don't you want $page->of(false) at the top?
-
Thanks Soma, batch editing is definitely a useful feature to have on board. I wonder whether it may expand one day to offer like a Quick Edit in WP though to be fair it's already very useful as it is!
-
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 } }
-
Thanks guys!
-
Call me stupid (please don't, I may cry) but how do you actually use this? Can you use it to style things in the CSS? Would you need to use inline styles?
-
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.
-
Unique Private Photo Gallery With User Login
onjegolders replied to NooseLadder's topic in Getting Started
As a brief answer before getting perhaps a more complete one from one of the more advanced PW crew If each user had a login and also their own page under say a template "client", you could make sure that only they can see their general client page by checking if their $user->name and the $page->name are the same, if it is, you are safe to output their content as only they will get to see the page content. Something like: if ($user->name === $page->name) { // show all the pictures and other member stuff } else { throw new Wire404Exception(); } This is all quite basic and you could turn on urlSegments so that you could have gallery on an additional page. Again only those who have the credentials to get to the client page will see the pages beneath it. I've used this method to create whole member areas, if you're interested I'll share with you what I did. In terms of the actual images that will be stored somewhere in assets/files/... you'll want to protect them somehow (unless protecting through obscurity is enough for your purposes) but will have to let one of the more advanced users advise on this. EDIT: To sum up, you could have the following page tree: Home About Clients (clients template) -- Joe Bloggs (client template) -- Jane Bloggs (client template) One thing that can get annoying is having to make sure you're creating both the user and the page and that they share the same name. As my editor was the person adding clients, I made a simple front end template for them to add clients through which created the user and the page at the same time. You could also just extend the built-in user template to add images and use that but I've found that in the long run having non user pages is more flexible for outputting data. -
For the rating itself, it would be nice to have the user hover over the stars to vote, I'd have to figure out the CSS of that and how to convert stars to an integer in PHP (I'm learning on the job!)
-
Thanks for the feedback Ryan, I'll add that validation and I think you're right, it would be nice to have a rating module (it's a completely non-critical module but still ) It all adds up!
-
Thanks guys for your views, I guess I know why I use PW but do the clients or collaborators really care about our reasons? So with clients you're saying that PW enables it to be more trouble-free in the long run? Less updating? Just interested how you convince the clients that they don't want that nice shiny plug and play system they saw in an advert/their auntie has/ their web designer in 1998 used.
-
Just a quick one, it's a discussion that comes up the whole time between me and my brother (who's been designing sites for years and uses primarily Joomla). He sometimes tries to offer me work if he has too much going on but he'll normally say something along the lines of "The client wants a real estate system or he wants to be able to include a job board so it's best if we use Joomla (or WP)" I'll say yeah but I can do all that in Processwire and it'll be all my own work and we'll have much better control over the output etc. At which point he'll say: "Ok but how long will it take you to code? Will it have the same number of features and years of testing that these modules have? I can install one of these modules and have them up and running in an hour or two" Then I'm stumped. I was just wondering how some of you guys justify building things yourself when there are ready made modules out there. Even for the PHP and PW experts among us, it would presumably take quite a while longer to code from scratch. I know why we all use PW, it's because it's so flexible and gives us ultimate control but how to explain that to someone else? I'm at the point where I'm just going to forge ahead and try and do everything in PW anyway because I just can't stand the way Joomla and others do things but it's a tough argument I'm up against! Your views?
-
Just though I'd post in case anyone else was interested in creating a 5 star rating system. It is very rudimentary I should point out and am sure there are thousands of better ways but it seems to get the job done OK for me. It's only using cookies to check if someone's already voted so it's not at all foolproof! If any advanced users have any pointers to improve it, that would be great! <?php include("./header_plain.inc"); ?> <div id="new_blog_view" class="row"> <div id="blog_header"> <a href="<?php echo $config->urls->root; ?>"><img src="<?php echo $config->urls->templates; ?>styles/images/ag_logo_2.png" alt="" /></a> <h4><a href="<?php echo $page->parent->url; ?>">From the Blog</a></h4> </div> <h1><?php echo $page->title; ?></h1> <h6><?php echo $page->entry_date; ?></h6> <?php if ($page->image) { ?> <img src="<?php echo $page->image->url; ?>" alt="<?php echo $page->title; ?>" id="blog_image" /> <?php } ?> <?php $class = "new_blog_view_content"; if (!$page->image) { $class .= " divide"; } ?> <div class="<?php echo $class; ?>"> <?php echo $page->body; ?> </div> <?php echo $page->comments->render(); ?> <?php echo $page->comments->renderForm(); ?> <?php if ($page->vote_count > 0) { $vote_average = round($page->vote_score / $page->vote_count, 2); if ($vote_average > 0 && $vote_average < 1) { $url = $config->urls->templates . "styles/images/stars_0.png"; } elseif ($vote_average >= 1 && $vote_average < 2) { $url = $config->urls->templates . "styles/images/stars_1.png"; } elseif ($vote_average >= 2 && $vote_average < 3) { $url = $config->urls->templates . "styles/images/stars_2.png"; } elseif ($vote_average >= 3 && $vote_average < 4) { $url = $config->urls->templates . "styles/images/stars_3.png"; } elseif ($vote_average >= 4 && $vote_average < 5) { $url = $config->urls->templates . "styles/images/stars_4.png"; } elseif ($vote_average = 5) { $url = $config->urls->templates . "styles/images/stars_5.png"; } ?> <h5>Current rating:</h5> <p><img src="<?php echo $url; ?>" width="100" height="25" alt="<?php echo $page->name . " - " . $vote_average . " stars"; ?>"/><span> (<?php echo $vote_average . "/5"; ?>)</span></p> <?php } ?> <?php $rating = $page->vote_score; $votes = $page->vote_count; $out = ""; if (isset($input->post->submit_rating) && $input->post->test == "") { $out = "<h5>Thank you for rating!</h5>"; $new_rating = $input->post->rating + $rating; $votes++; $page->of(false); $page->set("vote_score", $new_rating); $page->set("vote_count", $votes); $page->save(); $voted = true; $page->of(true); // set cookie to ensure only 1 vote (not foolproof!) setcookie('voted',$page->name,time() + (86400 * 7)); echo $out; ?> <?php } elseif(isset($_COOKIE['voted']) && $_COOKIE['voted'] == $page->name) { echo "<br>You have already voted, thank you!"; } else { ?> <div id="rating_box"> <h4>Please feel free to rate this article!</h4> <form action="" method="post"> <select name="rating" id="rating">Your rating <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <input type="text" id="test" name="test"> <input type="submit" id="rating_submit" name="submit_rating" value="Submit rating"> </form> </div> <?php } ?> <a href="<?php echo $pages->get("/blog/")->url; ?>" id="back_blog_link">← Return to Blog</a> </div> <?php include("./footer_plain.inc"); ?>
-
ProcessWire Conference 2013 / London / Cambridge
onjegolders replied to ryan's topic in News & Announcements
even that's not quick stroll...! -
Good job, nice and clear, easy to use
-
Using the comments module, is there anyway to do a session redirect after the comment has been submitted so that the page reloads and the comment is now on the page (obviously will only apply to comments that are automatically approved, but it would be nice for them to see their comment live and I don't think the user would think to refresh the page.
-
Cheers Pete! Also noticed that I was getting repeat tweets, don't know if this is due to editing an existing file...
-
Hiya Pete, Wanted to ask if there was anyway to output the page's title in the link somehow. At the moment I can either have - New blog article - bit.ly/hkhkhkkkh OR New blog article - http://www.mysite.com/blog/jkhjkhhkhkhkjhkjhjkhjk Would be great to have it output the page's name though I have no idea if that's even possible. Thanks anyway for a really useful module!
-
Just wanted to say that with the speed (and quality) of module development lately by the community and with the addition of Ryan's Form Builder (and a few profiles on the way) I really feel like there is less and less need to consider alternatives to PW for most projects. I'm so happy with the way things are moving, the API has always been so strong and gradually some quality additions are appearing that are just going to take this system to the next level. Once again, a big thanks to Ryan (+Apeisa, Soma, Diogo, Pete, Nico, Wanze and so many others) for all your continuing hard work! I'm excited by where PW will be in 12 months time!
-
Ideas for a dashboard / widget system?
onjegolders replied to MadeMyDay's topic in Module/Plugin Development
+1 if you get the time, would be a cool addition -
I wanted to move modules into setup as I'm not in there that often but I guess not all pages can be subpages. Still, it's great that it's so easy to modify so much
-
Thanks Wanze, you know I didn't even realise I could access admin pages from the tree?! Cheers!
-
Aha! Gotcha, makes a lot of sense actually! Thanks Apeisa, I may bump them up a bit, just always hard to find a balance keeping things elegant yet also readable. Thanks for the feedback!
-
Sorry, I know it sounds stupid but what do you mean by flipping it horizontal? Landscape instead of portrait?