Leaderboard
Popular Content
Showing content with the highest reputation on 07/05/2013 in all areas
-
The modules directory has been updated so that it talks a lot more with GitHub behind-the-scenes. This provides the following new features for modules that are hosted at GitHub (which is the majority): It keeps your module version up-to-date automatically. You no longer need to go in and edit your module listing to bump the version number. It performs this check on every GitHub repo linked by the directory, once per day. So once you update the version number in your module's PHP file (getModuleInfo), and have it committed to GitHub, that's all you have to do, as the directory will detect the change in a few hours. When you add a new module, it is able to pull in most of your module's information automatically from GitHub after you specify the project URL. As a result, the add new module link asks for your project URL before anything else. The directory now displays the contents of your README file at GitHub, and keeps it up-to-date automatically (checking it once per day). Because of this, you may no longer find it necessary to use the directory's built-in Extended Description or Instructions fields. I recommend that you have your README in either Markdown (README.md) or Textile (README.textile) format, which just looks better, but plain text is of course supported too. Hopefully this makes it a whole lot easier to keep your modules up-to-date in the directory. Please let me know if you run into any issues with it. Please note: Your module must have the same name as the repository. Meaning, if your repo is named MarkupTwitterFeed then your module must be named MarkupTwitterFeed.module. This appears to already be the case with all the modules in the directory, so I'm not sure this even needs to be called out, but figured it was worth mentioning just to be sure.8 points
-
Try contacting those who made current version via related forum thread, http://processwire.com/talk/topic/926-french-fr-fr/. If they're no longer around, you could always release your own version anyway. Translations can be found from modules directory, see http://modules.processwire.com/categories/language-pack/. If there's an outdated version there, you'd have to either find the original author or ask Ryan for help with this. I'm afraid that this is really a question to Ryan, but as a partial answer: so far I can't remember hearing of any security issues with PW, so there's not much data to base this on, but I would expect all affected (and still available via GitHub etc.) versions to be fixed if one was actually found. If not by Ryan himself, then definitely by someone else around here. We're rebuilding some sites with PW that were originally built almost a decade ago.. so I would definitely answer "yes" here. In our case 4-5 year lifespan is very common and I honestly wouldn't have even considered PW if I thought that was a problem. Minor versions (as in 2.1, 2.2, 2.3) tend to be pretty big updates for PW, though I don't think any of them has really broken anything big time -- I've updated sites successfully from 2.1 => 2.2 => 2.3 without having to rewrite any code at all. Ryan has definitely made these updates pretty painless, trust me (just take a look at this thread, where version 2.4 compatibility with 3rd party modules was discussed.) On the other hand I would still recommend taking the approach of only updating sites between those if there's a need for it. It would be nice to always have all your client sites (especially if you're hosting those yourself, like we are) at the same (and latest) version, but honestly speaking that's not always meaningful. If there's something in the next minor version you really need, then by all means update. There have been proper update instructions for these jumps that you really should read first, though switching from 2.2 to 2.3 pretty much only meant replacing core files with new ones and so on. Updating from 2.0/2.1 to 2.2 was a bit more complex, I believe, as 2.2 introduced whole language support system - we probably won't get that kind of stuff all the time.. Keep in mind that PW is nothing like WP, where unattended site becomes a black hole of security issues in a few months. As I mentioned before, I haven't heard of a single, fatal security flaw so far and I've been around for a while. Oh but we do: http://processwire.com/talk/topic/1109-processwire-irc-channel/ No problem - and welcome to the forum!5 points
-
I work locally using MAMP Pro (OS X). The 'problem' for me has been getting a development version in front of a client. I can't use port-forwarding and DynDNS at all and I'm a command line & GIT noob. But I recently discovered Pagekite which lets you tunnel your localhost to a publicly available URL. With a bit of tweaking on the MAMP Pro side of things I can serve a locally running site to a client for, not only review, but for them to add content. Example. The last bit of the process is uploading the site files and moving the database when going live. If anyone is interested in more details of my setup let me know.3 points
-
2 points
-
Hi, thank's a bunch for your nice answer! As I don't see any module translation I guess then all translations(core + community modules) goes into one topic(e.g: http://processwire.com/talk/topic/926-french-fr-fr/)? All into one github project? ahhh well, I guess I passed too much time worrying about my sites getting hacked with drupal/wp. I find it nice how we handle the switch from mysqli -> PDO, it's reassuring. I guess breaking some little things in 2.x versions will make PW3 less hard to upgrade to(at least I hope ). I think this need to be the default, it would be nice to be more than 5 . thank's for your warm welcome and the time you took for answering me!2 points
-
Took me some time to answer you, Soma, but finally: Actually I didn't mean the usual "cache rendered page content" but only "cache indirect relations to not have to procedurally query for them on every request". Sorry for confusing here. Actually, I tried to repeat the querying and sorting with around 5 articles and 10 tags in a for loop a thousand times and took some three seconds, which is totally ok. Still I like solutions that scale better Well, you're definitely right here and I would probably have went for that route, but I really don't like working my way around the Pw API, so I was looking for a better solution. Thank you so much, this is just a great and I will take that route right now! I already did quite some module programming and also even started, but my approach would have been to check only for changes on saving "articles" and add/remove from the "authors" array with that information. That would have brought up quite some edge cases to think about, which is why I posted. You solution, on the other hand, is just doing the complete query for the "authors" tags on each save of an "article", which makes this whole thing a LOT easier. I just didn't see the wood for trees here, so thank you a lot! Edit: If anyone is interested in this, here is the module code I finally used, very close to what Soma posted. There are still two drawbacks with this solution: The querying for author's tags will still be slow. It is only done if it is necessary and it slows down the editor, not the site user, so it's ok. Might run into problems, when there are thousands of tags and/or articles. Currently, if you delete an author from an article, his tags aren't regenerated. This is ok for my use case (will pretty much never happen) or at least wouldn't justify the work needed to get around this limitation. Since this is a functionality that is probably needed more often, I'll write the implementation of a universal module providing this functionality (without the two problems mentioned above for sure) on the list of "Great Processwire module ideas to do when there's enough time for it".2 points
-
1) Are your sure that the value 'portugal' is sent over get? So your URL is xxx?mysearchlocation=portugal 2) Some corrections to the code: // Do we have a get variable? if ($input->get->mysearchlocation) { // Sanitize it $mySearchLocation = $sanitizer->selectorValue($input->get->mysearchlocation); // This is not valid => $input->whitelist($test, $country); // Add it to the whitelist... with the same name as the get var! $input->whitelist('mysearchlocation', $mySearchLocation); // Do your search and render the pager.. i name the variable $resorts instead of $country $resorts = $pages->find("template=hotel, hotel_country=$mySearchLocation, limit=3"); $pagination = $resorts->renderPager(); foreach ($resorts as $resort) { // ... } } See also $input->whitelist() in the docs: http://processwire.com/api/variables/input/2 points
-
Hi all, I've finally managed to set up my website where I intend to post ProcessWire tutorials. The site (lessons) is very much WIP. I have tried to make the site as responsive as possible. I have only tested in Chrome and FF. I'd rather write more lessons than test in IE to be honest so I won't pursue that... I will try to post regularly but can't make any promises as to the frequency . I intend to randomly post some pre-planned lessons. I will update this forum post everytime I post something new. If you have questions, pointers, etc about any lesson, or a request for a specific lesson, please post them here. This way, other forum members can assist in answering the questions . Thanks. /k ==================================================================== Edit: 28 August 2014 - Fist Tutorial is up (OK, it's Blog Module documentation ) Creating a Blog in ProcessWire (Blog Module how to) - 28 August 2014 [99% done] Next: 'All you ever wanted to know about ProcessWire Modules [and other cool things]' - COMING very SOON1 point
-
Yeah of course:). But you think there will be ever a author with more than some hundred articles? And what count of tags do you expect? Nonetheless, I think if you likely to have less tags than articles this (following) will pretty fast (like what you do) and if you use markup cache to generate it only every hour or once a day: Just to give another example, in the authors template. I'm sure you know already but just for the record. $cache = $modules->get("MarkupCache"); // is already cached or expired? if(!$data = $cache->get("author_tags", 3600)) { $tags = $pages->find("template=tags"); foreach($tags as $tag) { if($pages->count("template=author, tags=$tags")) { $data .= "<a href='{$tag->url}'>$tag->title</a>"; } } $cache->save($data); } echo $data;1 point
-
They also drink beer? I guess they also talk about you? Be cautious with the NSA¡ (hey guys!)1 point
-
Thanks for posting your solution! Ok got it about the cache. Hah, yes the $array->removeAll() can be way easier than a complex add remove, possible but maybe not really needed. It's just like clear and put back the new values. Yeah I agree with what you say. At some point you maybe better switch to an advanced SQL statement to make sure it's as fast as possible. Yea an universal module would be possible also but just a lot more work. But actually fun. Something random and minor: You can also use the shorter $event->arguments("Page"); About the method. I was thinking if there's an simpler way to collect the tags and add them. The only one I can think of is this: $articles = $pages->find("template=article, author=$author"); $author_tags = new PageArray(); foreach($articles as $art) $author_tags->import($art->tags); What you think? Should be faster I think.1 point
-
Not sure what's about the cache thing? Do you have cache on templates? Well it's a naive way, but if you don't go to thousands or ten thousands of tags and articles, you should be fine. I have pretty large sites with lots of things happening like this and I don't even need caching because it's so fast. You can always create a custom SQL query, and join the tables you need. Creating a module isn't complicated or lot of work at all! It same as you code in the front-end and you already know how to do it. Here's a module done in 2 minutes and half the code is yours from above: <?php class TagsHelperAuthor extends WireData implements Module{ public static function getModuleInfo(){ return array( 'title' => 'TagsHelperAuthor', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init(){ $this->pages->addHookAfter("save",$this,"hookPageSave"); } public function hookPageSave(HookEvent $event){ // get current page saved $page = $event->argumentsByName("page"); if($page->template == "article"){ // save tags to page field on author page or any page $authorPage = wire("pages")->get("template=author, name=Authorname"); $authorPage->tags->removeAll(); // remove all tags first $authorTags = new PageArray(); $allTags = wire("pages")->find('template=tag'); foreach ($allTags as $tag) { if(wire("pages")->count("template=article, tags=$tag")) { $authorPage->tags->add($tag); } } $authorPage->save("tags"); // save only the field of the author page } } } Not tested but should give you a hint. Edit: The idea is on every Article save, you update the authors "tags" field and add/save them there. You would just have to adapt it as I don't know your structure exactly. (Changed the $pages to wire("pages") because it's in a function.)1 point
-
I'm trying to think about this using a music analogy..... Article = Song Author = Artist Tag = Genre In many cases, artists belong to one or two genres and their songs follow suit... What am not clear about is are you tagging the "authors" or are you tagging the "articles". For instance, an article tag could be "health", "obesity", etc. Author tags could be "fiction", "academic", etc....1 point
-
That works perfectly Wanze thank you for the help, I really appreciate it! My value for 'portugal' was being sent correctly so that I got it in my URL, I wasn't using the implementation of $input->whitelist correctly to store it. Again thank you for all your help1 point
-
@fatih - I would suggest that you change all of the passwords you linked to in your last post, as anyone reading it can now mess up your hosting. Also, Google indexes these forums extremely quickly so it is likely that anyone can now access your hosting. Never post real usernames/passwords in forums - if you need to pass on such details, use the personal message feature here or encrypted email. @dups - you seem to have done the same in your first post too!1 point
-
1 point
-
Greetings Horst. Beautiful photos! You obviously have talent, and the imagery in your web site does a great job of showing your skills. I like the way you introduce the various themes for your work. I have some small comments, which may follow some of what has been said here already: 1. Perhaps add more direct mentions of your themes on the home page? 2. The home page slider should perhaps identify the theme of each of the slideshow images. 3. The home page slider does not "light up" the disk of the current image. 4. The galleries load extremely slowly. Sometimes, images scroll to the next one before they load. 5. It would be great to have some brief statements in writing from you in key places throughout the site -- just a bit more of who you are or what is behind the work we are looking at. My comments come from viewing the site with Safari and Chrome on an iPad 3. I will take a look from desktop later. Thanks for sharing, Matthew1 point
-
Some fun stuff just pushed to the dev branch: the core now includes a Modules Manager "Lite". The screenshots below best describe how it works. But it lets you install modules from the directory just by typing (or pasting) in the module's class name. It also provides a 1-click capability to check for a given module's updates and upgrade it when necessary. Beyond that, the modules screen is now split into tabs: Site, Core and New. Site shows just your /site/modules/, and Core shows just your /wire/modules/. The New tab is where you can install modules. I really wanted a solution that kept the actual browsing for modules out of the CMS. Not because I think it's a bad idea (it's a great idea) but because I wanted the modules directory (modules.processwire.com) to serve that purpose as much as possible, at least as a default. That way I don't have to worry about scalability as the size of the modules directory increases. Plus less automation might make the newbies be a little more careful about what they are installing and where it's coming from. The power of the automation in ModulesManager here is so powerful it scares me, so think it's better for the users that know what they are doing. Lastly, ModulesManager is one of the best modules out there and Soma does an amazing job with it. Bringing a little taste of ModulesManager into the core I thought would help both projects. Most credit for the new core "Modules Manager Lite" goes to Soma (though he doesn't yet know that). It's all built around his code lifted directly from Modules Manager. Hope that's okay Soma? Your code now powers not just the new stuff in ProcessModule, but also the new WireHttp::download function, and the new wireUnzipFile() function, all added this week. People who want the most power will still want to use Soma's Modules Manager. That does a whole lot more than the built-in one does, including installation of themes, checking for updates en-masse, and browsing and filtering through the modules directory. But now you can install ModulesManager or other modules without having to manually FTP things to your server (so long as your /site/modules/ is writable). Please let me know if you guys run into any issues with it.1 point
-
Shopify is another decent payment solution to integrate with ProcessWire. Shopify is pretty much self running and easy to setup (they host it), but has a feature called post order hooks that you can have ping your defined URLs (in your PW installation) with JSON data about a completed order, etc. This makes it fairly simple to create or modify user accounts or other pages based on the results of a store transaction.1 point
-
1 point
-
Hi Grays, welcome to the forum. Even though I have been playing with PW for a couple months now, I too am still very green and new to it. I was in the same boat as you and still am trying to grasp the basics, but take the advice of everyone else above. The people here on the forums are very helpful and friendly. Don't be afraid to ask questions. There are a lot of smart peeps here and I find this is one of the most friendliest, most responsive CMS forums of them all. Make friends with other newbies (such as myself) and follow the questions they ask. Seach the forums for the ones asking basic questions and those will more likely be the newbies. I think for me, the best thing I could do was to take it slow and lower my expectations. I fell in love with PW right off the bat and wanted to be a a pro in it. But, even though I had read a few PHP books and took some courses beforehand, in reality I was lost and dissapointed. It's more a mental/confidence thing with me, but once I accepted the fact that it was going to take some time, and I wasn't going to be an immediate whiz, things got easier. So. I started off (still am) doing the basics, one thing at a time. Break up your site into smaller parts and work on each one by one. When you get something simple working, your pride will fuel the next challenge and before you know it, you'll be at the top. Analyze the code here in the forums and don't just copy/paste. Try to really understand it by cross checking with how PHP works. A great thread started not long ago on learning PHP is here. You may not understand it in one try, I know I didn't. Sometimes it takes days or weeks for something to "click" in your head. Read, re-read, read again. Things DO get easier but it takes time, and time is the secret. Practice helps. It's inspiring what you can do with PW and what keeps me going is knowing this is the best CMS out there. I have researched and tried almost all of them over the years, but nothing compares to PW. I am inspired every day to continue learning and not giving up because it's absolutely worth it. MY breakdown to how I am learning: Take it slow. Break code examples down line by line. Moving on to the next line only after knowing what each before it does. You'll get it! Don't attempt something expecting results the first time. Take pride in humiliation. You can only learn after making mistakes. Read this PW wiki Study Codecademy PHP course along with a couple PHP books. Try to go through every forum completly. Go through each page one by one, bookmarking where you left off. I do this before I go to bed. Before you know it, you'll have read all the forum topics and can know be updated when new threads post. ask questions. I know this can be kinda hard because you don't want to look like an "insert insult", but the truth of the matter is if everyone is afraid to ask then it's hard for newbies like you and I to find answers to basic questions. It's a win win for everyone and the CMS itself. breaking down basic elements of a site one section at a time and searching the forums for how to do it (navigation, multi-level navigation, photo gallery, forms, etc..) You may have to read multiple threads but it's all there. Good luck and don't give up! I can never look back at any other CMS, even during times when I'm frustrated or lost! I only get frustrated with PW because I do not know YET how to proficient. I was frustrated USING other CMS's because of how they were built and I knew their code. Says a lot right there.1 point
-
When you get into sending POST data, ProcessWire has an http class that you can use rather than something like CURL. The benefit of using PW's WireHttp class is that it will fallback to sockets if it has to, ensuring the class works just about everywhere. Here's an example of the same web service we outlined above, except that this one posts to it: $data = array( 'username' => 'ryan', 'pass' => 'mypass', 'email' => 'info@grab.pw' ); $http = new WireHttp(); $result = $http->post('http://www.domain.com/path/to/service/', $data); if($result) { $result = json_decode($result, true); if($result['status'] == 'success') echo "Success! $result[message]"; else echo "Error! $result[message]"; } else { echo "error posting data"; } As a side note, this service is using the same password for the user to add, and the web service password. In reality, you'd probably want those to be different things.1 point
-
Hi Jan ProcessWire is hugely more flexible that Wordpress and you don't need to know much php at all - in fact, the ability to copy and paste is probably more important! (Especially with all the help round here). There is no strict theming system for ProcessWire in the way you would think of for Drumlapress (!) - basically because that would limit the creation of bespoke websites far too much. The system as it works now means that as long as you can write good HTML and CSS, you can create a brilliant site, without having to learn a templating system. You can more or less approach it in the same way as you would a static site - though, of course, you can get a lot more clever too. If you are looking to integrate it with a framework, then that is as easy as it is with a static site. But, so you get the idea, here is is a veyr stripped back basic profile using Bootstrap: http://modules.processwire.com/modules/bootwire-starter-profile/ As for things like galleries and other plugins, because of the way the site is constructed you can integrate ANY plugin without worrying about it having to fit in with the way the system works. Since there is NO JQuery or anything else for the front end until you actually put it there, you wont run into any conflict trouble with anything supplied by ProcessWire. You simply go and install the plugin in the way the developer says and then learn some very basic php and PW syntax to encorporate your data. Galleries are so simple that it is a joke. As for things like blogs - if you want something very simple (a basic "post some news" sort of thing) then it is so easy to create your own system to work the way you want it to. So, all in all, although it would not be of instest to the average Wordpress user, for any designers out there, it is the perfect way for them not only to design what they want, but in the process learn some basic development skills, which never goes amiss! I am a prime example - I am a copywriter, composer and advertising guru, and yet I am creating my own, very complex blog profile, have created several complex brochure site systems and am learning like mad. I strongly suggest you read the following: Showcase: http://processwire.com/talk/forum/9-showcase/ Detailed beginners tutorial: http://wiki.processwire.com/index.php/Basic_Website_Tutorial (written by me who is not a dev) Explanation of Pages: http://wiki.processwire.com/index.php/Pages You will also find that although there is some serious knowledge amongst the community here, not all of us are developers - but all of us have been surprised how much we have learned. Stay and enjoy! Joss1 point
-
Once you've got your form, I think it'll be fairly easy to develop this. But your date fields are the only thing that's going to need a little extra work. Since you are asking for just month and year (no day) you'll want to qualify that to the beginning of the first month and the end of the second month. Finding the beginning of the first month is easy since all months start at day 1. There are various ways to find the end of the second month, but there's one way in my example below. Here's how I might perform the query from the API side (written in the browser so may contain typos): // where we will store our $pages->find selector $selector = array(); // add the search query if present if($input->get->search) { $search = $sanitizer->selectorValue($input->get->search); $selector[] = "title|body~=$search"; } if($input->get->yearFrom && $input->get->monthFrom) { // construct date like 2012-12-02 and convert to timestamp $dateFrom = strtotime("{$input->get->yearFrom}-{$input->get->monthFrom}-01 00:00:00"); if($dateFrom) $selector[] = "date>=$dateFrom"; } if($input->get->yearTo && $input->get->monthTo) { // do the same for month-to, but find the beginning $dateTo = strtotime("{$input->get->yearTo}-{$input->get->monthTo}-01 00:00:00"); // now find the end of dateTo month by adding 1 month and subtracting 1 second if($dateTo) $dateTo = strtotime("+1 MONTH", $dateTo) - 1; if($dateTo) $selector[] = "date<=$dateTo"; } // determine and validate the max records to show $limit = (int) $input->get->limit; if($limit > 50 || $limit < 1) $limit = 10; $selector[] = "limit=$limit"; // specify the template we are limiting the search to $selector[] = "template=article"; if(count($selector)) { // perform the search $selectorString = implode(', ', $selector); $articles = $pages->find($selectorString); echo "<h2>Found " . $articles->getTotal() . " articles matching your query.</h2>"; echo $articles->render(); // or however you want to output them } else { echo "<p>No search specified.</p>"; }1 point
-
I recently had to setup front-end system to handle logins, password resets and changing passwords, so here's about how it was done. This should be functional code, but consider it pseudocode as you may need to make minor adjustments here and there. Please let me know if anything that doesn't compile and I'll correct it here. The template approach used here is the one I most often use, which is that the templates may generate output, but not echo it. Instead, they stuff any generated output into a variable ($page->body in this case). Then the main.php template is included at the end, and it handles sending the output. This 'main' template approach is preferable to separate head/foot includes when dealing with login stuff, because we can start sessions and do redirects before any output is actually sent. For a simple example of a main template, see the end of this post. 1. In Admin > Setup > Fields, create a new text field called 'tmp_pass' and add it to the 'user' template. This will enable us to keep track of a temporary, randomly generated password for the user, when they request a password reset. 2a. Create a new template file called reset-pass.php that has the following: /site/templates/reset-pass.php $showForm = true; $email = $sanitizer->email($input->post->email); if($email) { $u = $users->get("email=$email"); if($u->id) { // generate a random, temporary password $pass = ''; $chars = 'abcdefghjkmnopqrstuvwxyz23456789'; // add more as you see fit $length = mt_rand(9,12); // password between 9 and 12 characters for($n = 0; $n < $length; $n++) $pass .= $chars[mt_rand(0, strlen($chars)-1)]; $u->of(false); $u->tmp_pass = $pass; // populate a temporary pass to their profile $u->save(); $u->of(true); $message = "Your temporary password on our web site is: $pass\n"; $message .= "Please change it after you login."; mail($u->email, "Password reset", $message, "From: noreply@{$config->httpHost}"); $page->body = "<p>An email has been dispatched to you with further instructions.</p>"; $showForm = false; } else { $page->body = "<p>Sorry, account doesn't exist or doesn't have an email.</p>"; } } if($showForm) $page->body .= " <h2>Reset your password</h2> <form action='./' method='post'> <label>E-Mail <input type='email' name='email'></label> <input type='submit'> </form> "; // include the main HTML/markup template that outputs at least $page->body in an HTML document include('./main.php'); 2b. Create a page called /reset-pass/ that uses the above template. 3a. Create a login.php template. This is identical to other examples you may have seen, but with one major difference: it supports our password reset capability, where the user may login with a temporary password, when present. When successfully logging in with tmp_pass, the real password is changed to tmp_pass. Upon any successful authentication tmp_pass is cleared out for security. /site/templates/login.php if($user->isLoggedin()) $session->redirect('/profile/'); if($input->post->username && $input->post->pass) { $username = $sanitizer->username($input->post->username); $pass = $input->post->pass; $u = $users->get($username); if($u->id && $u->tmp_pass && $u->tmp_pass === $pass) { // user logging in with tmp_pass, so change it to be their real pass $u->of(false); $u->pass = $u->tmp_pass; $u->save(); $u->of(true); } $u = $session->login($username, $pass); if($u) { // user is logged in, get rid of tmp_pass $u->of(false); $u->tmp_pass = ''; $u->save(); // now redirect to the profile edit page $session->redirect('/profile/'); } } // present the login form $headline = $input->post->username ? "Login failed" : "Please login"; $page->body = " <h2>$headline</h2> <form action='./' method='post'> <p> <label>Username <input type='text' name='username'></label> <label>Password <input type='password' name='pass'></label> </p> <input type='submit'> </form> <p><a href='/reset-pass/'>Forgot your password?</a></p> "; include("./main.php"); // main markup template 3b. Create a /login/ page that uses the above template. 4a. Build a profile editing template that at least lets them change their password (but take it further if you want): /site/templates/profile.php // if user isn't logged in, then we pretend this page doesn't exist if(!$user->isLoggedin()) throw new Wire404Exception(); // check if they submitted a password change $pass = $input->post->pass; if($pass) { if(strlen($pass) < 6) { $page->body .= "<p>New password must be 6+ characters</p>"; } else if($pass !== $input->post->pass_confirm) { $page->body .= "<p>Passwords do not match</p>"; } else { $user->of(false); $user->pass = $pass; $user->save(); $user->of(true); $page->body .= "<p>Your password has been changed.</p>"; } } // display a password change form $page->body .= " <h2>Change password</h2> <form action='./' method='post'> <p> <label>New Password <input type='password' name='pass'></label><br> <label>New Password (confirm) <input type='password' name='pass_confirm'></label> </p> <input type='submit'> </form> <p><a href='/logout/'>Logout</a></p> "; include("./main.php"); 4b. Create a page called /profile/ that uses the template above. 5. Just to be complete, make a logout.php template and create a page called /logout/ that uses it. /site/templates/logout.php if($user->isLoggedin()) $session->logout(); $session->redirect('/'); 6. The above templates include main.php at the end. This should just be an HTML document that outputs your site's markup, like a separate head.inc or foot.inc would do, except that it's all in one file and called after the output is generated, and we leave the job of sending the output to main.php. An example of the simplest possible main.php would be: /site/templates/main.php <html> <head> <title><?=$page->title?></title> </head> <body> <?=$page->body?> </body> </html>1 point
-
If you use jquery theres some easy way and do it client side. If you add ?q=searchword to the search result links it's easy possible. Some helpful links To get a url parameter http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery An lightweight plugin to highlight the word on page http://bartaz.github.com/sandbox.js/jquery.highlight.html1 point