Leaderboard
Popular Content
Showing content with the highest reputation on 11/16/2012 in all areas
-
Just wrote a little about why I am here and not there http://www.mademyday...-over-modx.html // fixed URL, sorry.3 points
-
<?php // Check if there are any images if ($page->images) { // Loop through all the images foreach($page->images as $img) { $thumb = $img->size(100,100); // Create the thumbnail echo "<a href='$img->url'><img src='$thumb->url' alt='$img->description' /></a>"; // Echo <img> with thumbnail, wrapped with link to original image } }2 points
-
This line looks wrong to me: if($u->user_status = 'inactive') shouldn't it be like this: if($u->user_status == 'inactive')2 points
-
Hi p_hammond, This is a simple task in Processwire Give all your projects the same Template, for example "project". Assign an Image Field to this Template. This way, you can store one or more images in your projects. To grab the latest 6 projects with image (in your homepage template or portfolio), you can build a query like this: $projects = $pages->find("template=project, sort=-created, limit=6"); //Output the Images and link to project page foreach ($projects as $project) { //Grab the first image of field "images" $img = $project->images->first(); echo "<img src='{$img->url}' alt=''><br>"; echo "<a href='{$project->url}'>{$project->title}</a> }2 points
-
<?php if ($child->images) { // We have images } // You can also check the count if ($child->images->count() > 1) { // We have more than one image }2 points
-
The admin theme files are a combination of HTML/PHP, CSS, JS files and images. For the most part, it is no different from what you would create in your own site files (in /site/templates/). By default, the admin theme files are located in this directory: /wire/templates-admin/ STEP 1: To create a new admin theme, you would copy the default admin-templates directory (/wire/templates-admin/) to here: /site/templates-admin/ When ProcessWire sees /site/templates-admin/, it will use it instead of the default one. STEP 2: Now you can modify any of those files in /site/templates-admin/ and your changes should be reflected in the admin control panel. STEP 3: To distribute it to other people, you would just zip up the dir and then anyone else can unzip it to /site/templates-admin/ and have it work. I will be glad to setup a directory of admin themes on the site if anyone else decides to make one. That is all there is too it. But here are some other details and recommendations you may find helpful: MORE DETAILS: Why not just edit the files in /wire/templates-admin/ ? You certainly could do this, but you should consider everything in /wire/ specific to ProcessWire, and everything in /site/ specific to your installation. If you were to modify the files in /wire/templates-admin/, then your changes would get overwritten every time you upgraded ProcessWire. Whereas, /site/templates-admin/ is not overwritten during upgrades. What if I only want to change stylesheets and images? If you only need to change stylesheets and images, then I would recommend having your /site/templates-admin/default.php just include the one in /wire/templates-admin/, i.e. /site/templates/default.php: <?php include("/wire/templates-admin/default.php"); And likewise for any other files in there that have markup that you don't want to modify. This includes notices.inc and debug.inc. You'll also see a controller.php file there, but that is already just a placeholder so no need to make any changes to it. What are all the files in ProcessWire's admin theme and what do they do? Files you can edit: debug.inc - An HTML/PHP file that is included when $config->debug is true. It outputs general debugging information in the admin. default.php - The main HTML/PHP container template. All admin output goes through this file. notices.inc - Generates the markup for admin messages and error notices that appear at the top of the screen. scripts/ - Directory containing jQuery/javascript files. scripts/main.js - Main jQuery/javascript file that is run on all admin pages. All this does currently is setup a few minor form interactions. styles/ - Directory containing CSS files/stylesheets styles/main.css - Initial layout and styling for the admin control panel. styles/reset.css - Resets all browser styles styles/ui.css - User interface override styles. This is the last stylesheet loaded so it can more easily modify styles that came before it as needed. styles/JqueryUI/ Directory containing jQuery UI specific stylesheets and images. You can use jQuery UI's themeroller for these if you prefer. http://bit.ly/eTVbDC styles/ie.css - Styles specific to IE styles/ie7.css - Styles specific to IE7 and below. Because we don't support those, this basically just turns off IE7 support. styles/images/ - Images used by any of the above stylesheets. Files you shouldn't bother editing: controller.php - This is just a placeholder that includes a controller in /wire/core/. You should leave this file as-is. install-head.inc - These HTML files are used by the installer. You can edit them, but ProcessWire will still use the one in /wire/templates-admin/ since they are only used before installation. As a result, you can delete them from your /site/templates-admin/ if you prefer. install-foot.inc - See above. scripts/install.js - See above. styles/install.css - See above. Modifying form widgets with jQuery UI Most of the form inputs in ProcessWire are based on a jQuery UI theme. It is located in this file /wire/templates-admin/styles/JqueryUI/JqueryUI.css (and the images directory below it). Like the other CSS files, that can be edited directly. But since this was originally built using JQuery UI's Themeroller, you can continue to modify it with that if you'd prefer. Here is a link to it with ProcessWire's admin styles already pre-populated: http://bit.ly/eTVbDC Copyrights and Logo You should leave existing copyright notices, links to processwire.com and the name ProcessWire in place. You should also add a notice indicating "[Admin theme name] copyright [your name]", i.e. "Widget admin theme copyright Gonzo Deutschdeung". We also prefer that you keep a copy of the ProcessWire logo somewhere in your design, but it's up to you. A photoshop file of the logo at high resolution is attached to this message. pw2-logos.zip1 point
-
Just launched this site a few minutes ago. It's not totally done, as I've still got some detail work to do, but figured it was at a good point to share: http://www.houghtonacademy.org I did the design and development on this one. Like the blog profile, this one uses the Skeleton responsive CSS framework. Though I went a lot further with the media queries on the mobile side than I did for the blog profile. So you should see a nicely optimized layouts for tablets, mobile portrait and mobile landscape. So far only tested on iPhone though. Many of the graphics (though not all) are also optimized for Retina displays. When you get to the homepage, you should get a different photo and tagline on every page load. Highlights (in terms of ProcessWire development): Faculty Directory: http://houghtonacade.../about/faculty/ The data for the faculty directory is updated once daily and it pulls from a service called Veracross, that manages all their school systems. They are all represented as pages in ProcessWire, so the client can add unique biographies and such that aren't present in the service it pulls from. Form Builder is used throughout the faculty directory to power the individual employee contact forms. Events Calendar: http://houghtonacade.../news/calendar/ The events calendar uses jQuery plugin FullCalendar and it pulls from a ProcessWire-powered JSON feed. ProcessWire gets the data from a Veracross feed a few times a day, caches it, and creates a new feed specific to use with FullCalendar. The events data is also used on other pages in the site, such as the homepage. Photo galleries: http://houghtonacade...f/photogallery/ There are several photo galleries throughout the site, and they use the Photoswipe jQuery plugin, which is really great when using mobile as it duplicates the behavior of using the built-in iPhone photo gallery. Thanks to Soma for recommending this back in another thread. Video pages: http://houghtonacade...out/headmaster/ These are powered using the TextformatterVideoEmbed module and are responsive (per the latest update to this module).1 point
-
$projects = $pages->find("template=portfolio-item, sort=-created, limit=6"); foreach ($projects as $project) { $image = $project->images->first(); echo "<a href='{$project->url}'><img src='". $image->getThumb('thumbnail') ."' alt='{$image->description}'></a>"; }1 point
-
This module tries to help in very common admin task: emailing user a new password. I implemented this as a fieldtype, not sure if that is best way to go? I did it that way to allow simple API usage and offering easy customization (like in what position to put the reset checkbox etc). Simple Five Steps installation™: Copy the file FieldtypeSendUserCredentials.module to /site/modules/ directory Install the module from Modules section Create new field, call it "send_password" or whatever you like to call it. Important: choose SendUserCredentials as a fieldtype Edit user template (if you can't find it, Filters => Show system templates) Add new field there Usage from admin: Edit user and check the new field. Save. Usage from API: $u = $users->get("apeisa"); $u->of(false); $u->send_password = 1; // send_password = whatever you have named your new field $u->save(); TODO: Offer better security by requiring password change right after login EDIT: Removed the permanent Added few comments and better usage from API instructions FieldtypeSendUserCredentials.module1 point
-
Create a new User and a Role (for example "editor") and assign it to your user. He won't see Setup/Modules/Access anymore, because only users assigned to the role "superuser" see these pages by default.1 point
-
I was able to use your code successfully, Wanze, and now everything is working fine. Now, I've been wondering whether I can have an original, unchanged image on an individual project page and then have a thumbnail version of that image displaying in the homepage and the project list page. Does anybody know how I could do this? Thanks.1 point
-
1 point
-
That line (Pages.php:779) says: if(!$this->isDeleteable($page) || $page->template->noTrash) throw new WireException("This page may not be placed in the trash"); And isDeletable() if defined like this: public function isDeleteable(Page $page) { $deleteable = true; if(!$page->id || $page->status & Page::statusSystemID || $page->status & Page::statusSystem) $deleteable = false; else if($page instanceof NullPage) $deleteable = false; return $deleteable; } So, based on the above there are a few possibilities: $transaction is a NullPage object and/or hasn't got id defined: very likely, as this would be the case if no page was found when calling get() with that selector $transaction has status flag statusSystemID or statusSystem: very unlikely, but you'd probably know if such a flag had been set transaction template has noTrash property: possible, if you've checked it from Templates -> transaction -> System -> Disable Trash Option (System tab is shown only if you've got advanced=true in your config) I hope this helps. Edit: To sum it up, try wrapping that trash() call like this: if($transaction->id) { $transaction->trash(); } Edit 2: Sorry for confusing with all that stuff... Just noticed that trash() is being called with a NullPage object as an argument, so get() has definitely found no page. [ #0 [internal function]: Pages->___trash(Object(NullPage)) ]1 point
-
Is there anything in PW's error log in /site/assets/logs/ ?1 point
-
Haven't tried it yet but Jquery Cycle is nice: http://jquery.malsup.com/cycle2/1 point
-
I think the best responsive gallery is royalslider, but it costs $12: http://codecanyon.net/item/royalslider-touchenabled-jquery-image-gallery/461126 For free and also quite good: http://flexslider.woothemes.com/1 point
-
Since I can’t help so much with developing ProcessWire or PW modules (because I’m not a PHP expert yet), I’d be happy to help extending the documentation. So please tell me if I can help.1 point
-
1 point
-
If it's not in the sheet it's most likely also not in the documentation. I'll add it. I think there's still some useful things missing in documentation and so cheatsheet, but can't think of any ATM.1 point
-
Thanks for tracking this one down Teppo -- I will update the source to correct this per your fix.1 point
-
i just like to say a big THANK YOU GUYS i'm realy happy that my little wish got this huge reaction and i'm more than happy that it got real! pw motivated me a lot to dive into php and i hope i can give someday a littlebit back to the community (extensions , etc.)1 point
-
So simple! I am used to overcomplicate things thanks to my experiences with other CMS's. Thanks.1 point
-
1 point
-
http://www.simplescripts.com/articles/script_packaging http://www.simplescripts.com/developers1 point
-
Url Segments can be turned on a per-template basis. Basically if you turned it on for the "member" template. You can manipulate the url to show different content. Say if on your member pages, each member had some profile information but also many images and some files. On your "member" template, you could do the following: <?php if ($input->urlSegment1 == "photos") { include("./photos.inc"); } elseif ($input->urlSegment1 == "files") { include("./files.inc"); } else { // Display normal page stuff } ?> Then on your photos.inc file: <?php $photos = $page->images; foreach ($photos as $photo) { ?> <img src="<?php echo $photo->url; ?>" width="200" height="200" alt="<?php echo $photo->description; ?>" /> <?php }1 point
-
<!-- Members Template --> <?php if ($user->isSuperuser() OR $user->hasRole("editor")) { $members = $page->children(); if ($members) { echo "<ul>"; foreach ($members as $member) { ?> <li><a href="<?php echo $member->url; ?>"><?php echo $member->title; ?></a></li> <?php } echo "</ul>"; } } else { throw new Wire404Exception(); } <!-- Member Template --> <?php if ($user->isSuperuser() OR $user->name === $page->name) { ?> <h3>Hi <?php echo $page->title; ?> Welcome back</h3> <?php if ($page->images) { ?> <h5>Here are your images</h5> <?php foreach ($page->images as $image) { ?> <img src="<?php echo $image->url; ?>" alt="<?php echo $image->description; ?>" /> <?php } ?> <?php } ?> <?php } else { throw new Wire404Exception(); } <!-- Login Template --> <?php $out = ""; $form = " <form action='./' method='post' id='login_form'> <label for='login_name'>Username</label> <input type='text' name='login_name' autofocus> <label for='login_pass'>Password</label> <input type='password' name='login_pass'> <input type='submit' id='submit' name='login_submit' value='login'> </form> "; if($input->post->login_submit) { // process submitted login form $name = $sanitizer->username($input->post->login_name); $pass = $input->post->login_pass; if($session->login($name, $pass)) { if ($user->isSuperuser()) { $session->redirect("../members"); } else { $session->redirect("../members/$name"); } } else $out = "<h2>Login failed, please try again.</h2>"; $out .= $form; } else { $out = "<h4>Please sign in, in order to view your profile page.</h4>"; $out .= $form; } include ("./header.inc"); echo $out; include ("./footer.inc");1 point
-
Hi Noose, will your client have access to the admin? I'm guessing yes. Essentially once you've done it once you will find it simpler. You will create pages of type "member" which will sit under "members". You will also create users. You want the username to match the name of their corresponding "member" page. In your templates you will check to see if user->name is equal to $page->name. If so, they can see the page. The easiest way is to get the member to login (I can show you all my templates if you like) If their login is successful, they will be redirected to their profile page which will be at /members/john-doe/ And this will contain any information which has been stored on their page, including images, files, anything relating to just them.1 point
-
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 images1 point
-
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 point
-
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." } There is a already a tutorial for this http://processwire.com/talk/topic/1015-switching-from-drupal-to-processwire/page__hl__drupal1 point
-
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 point
-
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 point
-
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.1 point
-
You can download Processwire (including the default profile) or the blog profile. Those are really good starting points.1 point
-
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.1 point
-
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 point
-
"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; }1 point
-
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 point
-
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 point
-
Not at all, appreciate your help. I think I've found what I'm looking for: <?php function treeMenu(Page $page = null, Page $rootPage = null) { if(is_null($page)) $page = wire('page'); if(is_null($rootPage)) $rootPage = wire('pages')->get('/'); $out = "\n<ul>"; $parents = $page->parents; foreach($rootPage->children as $child) { $class = "level-" . count($child->parents); $s = ''; if($child->numChildren && $parents->has($child)) { $class .= " on_parent"; $s = str_replace("\n", "\n\t\t", treeMenu($page, $child)); } else if($child === $page) { $class .= " on_page"; if($page->numChildren) $s = str_replace("\n", "\n\t\t", treeMenu($page, $page)); } $class = " class='$class'"; $out .= "\n\t<li>\n\t\t<a$class href='{$child->url}'>{$child->title}</a>$s\n\t</li>"; } $out .= "\n</ul>"; return $out; } echo treeMenu($page, $page->rootParent);1 point