Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/20/2012 in all areas

  1. Ajax Search 1.1.0 There was a request for a ajax live search. So I went and created a simple module. Added in 1.1.0 * added key support for browsing results with arrow down and up. * added escape key to close results. * added close results on click outside http://modules.proce...es/ajax-search/ From the readme: This module progressively enhances the search form to an ajax live search. It will perform a search like you would use the form normally, and returns the output of the search page. So the search will still work without js enabled. There's some basic styling attached to this module in the "styling-example". You can use it to get started. See readme in there. Setup the search.php So it works almost out of the box with the basic install profile of ProcessWire, you only need make a minor change to the search.php template file to only return the content part (results) on a ajax request. To get the ajax search only return the content, open search.php and change the output on the bottom to this: ... if(!$config->ajax) include("./head.inc"); echo $out; if(!$config->ajax) include("./foot.inc"); Module Settings It comes with some module options to define various settings regarding the search form. Following a list with the defaults. Minium length = 3 min length for starting ajax request Close button text = 'close' close button text ID of searchform = #search_form if you have a different search form id,class ID of input = #search_query if you have a different search input id,class Query name = 'q' this is the default param name as_query_url = '' if left blank the script will take the action of the form Any help testing this module is appreciated. If you have any questions or problems setting this up feel free to ask here. Also feel free to use this as a starting point for your own, or take out the script to implement it differently. It's quite simple and can be adapted really quickly.
    1 point
  2. What are the components that people find useful in these frameworks? I know email and forms were mentioned previously. E-mail is something PHP does quite easily and well just with it's mail() function (though I understand some like to use alternate sending systems). When it comes to form systems, I don't feel like I've ever come across one that didn't leave me feeling like I wished I'd just built the form from scratch... though I'm working on something in that regard. But beyond email or forms, what are the components that people use in these frameworks? The only other component I commonly include in my ProcessWire installations is the Snoopy() class, for doing http requests. Beyond that, I've rarely come across a need to have other PHP components in my applications. Still, if there are some really common needs, perhaps we should look at expanding PW's performance as a framework and including more helpers/components for common needs. I'm just not sure what the needs are yet.
    1 point
  3. Considering that Processwire is a framework itself, in my humble opinion the most beneficial way would be to use PW with decoupled framework that can be used as a component library as well, so one could pick and choose useful components without the need to load the whole framework. So my choice would probably be somewhere among Symfony2, Zend and Flourish (though nobody prevents from using all of them). The problem is that when different components get involved, the coding style becomes less unified and readable. What do you, guys, think? Would be really cool to get a couple of tips here. Edit: onjegolders, also look at this article.
    1 point
  4. This may seem a bit hackish, but you could have multiple trees but keeping one main tree with all the fields of all languages. The other trees would be there only for constructing the urls. There doesn't have to be any field on their pages. The template for each of those pages can call the fields from the corresponding page from the main tree. So, for having the kind of urls you want (domain.com/en/products/productA), on your template you could do this (not tested): (--Assign this template to all the pages in the language trees--) // Here I will assume that English is the default language, and the main branch of the tree $de = $pages->get("/de/"); $pt = $pages->get("/pt/"); $parents = $page->parents; // An array with all the ascendants of current page if ($parents->has($de) || $page->name == "de") { // If current page is under /de/ $lang = "de"; } if ($parents->has($pt) || $page->name == "pt") { // If current page is under /pt/ $lang = "pt"; } if (isset($lang)) { // If not the default language -> change from if($lang) to if (isset($lang)) to prevent errors // Change to the correct language $user->language = $languages->get($lang); // Now we have to convert the $page object in the correspondent page from the main tree // I'm using a pagefield now (just include a pagefield on the template and choose the corresponding page from the main tree) $page = $pages->get("$page->pagefield"); } include("./{$page->template}.php"); // includes the original template file On the head, change the navigation to: (here i used the default theme as example) $homepage = $pages->get("/"); if (isset($lang)) $homepage = $pages->get("/$lang/"); Maybe this is confusing, and maybe not easy to deal with links later, i don't know... I will sleep and see if it still makes any sense in the morning edit: I did some changes in the code, The most important are: using a select page field, including the original template, and fixing the navigation
    1 point
  5. I heard a lot of good things about Yii Framework. Its learning curve's considered not as steep as of Zend Framework and it's much more compact and lightweight (Zend Framework components can be incorporated if needed). At the same time it's more powerful and feature rich then CI. Not sure if it will play well along with PW as it's full stack framework so its components can't be used separately. Symfony 2 looks like a totally new and fresh approach to frameworks, it's full stack but also based on decoupled components (so they can be easily entegrated into Processwire). I haven't have enough time to fiddle with it and, honestly, I think my expertise is not enough to fully appreciate its possibilities. It resembles me a modular synthesizer: if you don't know where each cord leads, what's the purpose of each slot and what knob tunes which sound parameter, all you get is noise at best or more often just silence It's easier to use semi-modular synth or even hard-wired one that suits your needs unless you need something truly unique and exlusive.
    1 point
  6. If I had to put it shortly: PW gives you (that are missing from many more traditional frameworks): Admin, users and access management UI for building your data schema (clicking on admin instead of coding) Url mapping to pages (no need to define routes) Something pretty similar to most (with a twist of course): PW API == GOOD ORM Controllers == template files can be easily used as a controllers What is missing (what some frameworks have): Crazy amount of helpers (as others have noted, using zend classes or flourish can be good help in that kind of situation) Routing (I hate doing routes... mostly repetition) Custom template languages Strict rules how to construct your code What pw "requires" that you might not like in your app: Unique database schema: you don't have single "posts" table, instead you end up with field_title, field_body, field_author, field_date etc.. tables MySQL, MyISAM
    1 point
×
×
  • Create New...