Leaderboard
Popular Content
Showing content with the highest reputation on 04/25/2012 in all areas
-
Just been reading this article and apart from wanting to applaud your enthusiasm and integrity, two points struck me in particular: Think MarcC's ideas of site profiles could appeal to large amounts of people. As a reasonably fresh-to-web designer, I love the control Processwire gives to me and my markup, the thought of having to use Joomla or Wordpress would fill me with dread. I am very aware however that although almost anything is buildable in PW, I couldn't build it. My brother who uses Joomla, often asks me what will happen when I need to set up a forum or a social network or a shopping cart. I would love to be able to build all this myself and as a firm believer in DIY code, I think it would be a cleaner solution but I just wouldn't have the expertise to pull it off - I do believe, however, there are one or two devs in this community who could make some really excellent profiles, which I would gladly pay for (and to which you should take a cut sir!) This sort of brings me to my other point. Let there be commercial addons (profiles) but let them be for very specific non-core functionality. In EE, the addons are generally terrific and I had no problem paying for Firemail (a newsletter system), or CartThrob as an example but it really hurts to have to fork out money for addons that you just know should be part of the core. They all add up. If I can handcraft a great site with PW knowing that if I need a large bit of expert functionality further on down the line, like a shop or a forum, I'd happily fork some money for it, as it would mean I wouldn't have to consider moving to the dark side (mentioning no names )3 points
-
My latest work, done in PW 2.1.0 www.voetvolk.be Lisbeth Gruwez|Voetvolk is a dance/performance group founded around dancer/choreographer Lisbeth Gruwez and composer/musician Maarten Van Cauwenberghe. Since its foundation in 2007, it has developed its activities as an international contemporary dance and performance company. Lisbeth Gruwez|Voetvolk functions as an autonomous and independent structure, relying on a network of co-producers and partners to realize its projects. Lisbeth Gruwez and Maarten Van Cauwenberghe are ‘Artists-in-Residence’ in the Troubleyn /Laboratorium of Jan Fabre. Sylvio1 point
-
Howdy people, Funny how I keeping coming across the threads of interest with the same crowd that is from EE background. I can share the same thoughts as onjegolders having been in EE shop for some years. The addons are great and freelance developers do great work but there are some fundamental addons that EL refuses to absorb into core (and I speculate) due to fact that they are running thin on support layer or perhaps in content with their earnings . What also attracted me to EE is that I had 1 place to get help. Today, you have to depend on 1man crew developers and cross checks where the issues is coming from - the core or the addon. So my suggestion is to provide some means to your 'developers' to earn % and not want to go on their own because you can facilitate their earnings and get a small % for doing so. Keeping things centralized is the key to organized and controlled growth.Otherwise you will end up with dozens of abandoned and cheap plugins that frustrate users that depend on them...WordPress anyone? The big addons/profiles that come to my mind are: -shopping cart -forums (some simple flavor of it...like Vanilla no pun intended) + forum bridges -photo gallery -LDAP connection (great for using this or any CMS within corporate intranets or SSO systems) ...the list can go on, I am sure plenty of users here can share their ideas. PW is sitting on truly excising grounds because so many things have been done right in its lean core. It would be really nice to see Ryan and few other leading devs. get their rewards and financial freedom from 9-5 tasks since it will only lead to better system for us to use.1 point
-
If I had to build a site like that, I would use ProcessWire. The only part that I think PW may not be the ideal fit is in giving all the restaurants admin access. Unlike something like Drupal, PW's admin isn't really intended for broad/community access, but rather for trusted individuals administering a site. But that's easy to get around by just coding the restaurant's tools on the front-end instead.1 point
-
The above will never resolve to false, so doesn't do anything. That's because find() returns a PageArray(). Think of it like a bottle that might have beer in it. An empty beer bottle is still a beer bottle. So you have to check if there's anything in it: $categories = $pages->find("template=category"); if(count($categories)) { // there are categories foreach($categories) { // output category } } I suggest using a separate 'category' template to handle the display of a given category (rather than trying to do it all in your 'categories' template). Here's the code you might do it with in your category template. This assumes the categorized entries have a field called "categories" $entries = $pages->find("categories=$page"); if(count($entries)) { echo "<ul>"; foreach($entries as $entry) { echo "<li><a href='{$entry->url}'>{$entry->title}</a></li>"; } echo "</ul>"; } else { echo "<p>No entries in this category.</p>"; }1 point
-
Technically you don't have to, as PW already has already sanitized the URL segments. But I think it's a good habit to sanitize anything is considered user input (as a URL segment would be). So rather than having to remember what you do or don't have to sanitize, I suggest just maintaining the habit of sanitizing everything that comes from input. They are not cached. Too many possibilities with GET vars in order to maintain a cache. Of course, you can always maintain your own MarkupCache if you want to. In the template cache options, you'll also see there is an option to make it bypass the cache when certain GET or POST vars are present. Sorry, my mistake. I think that the first part of the expression needs to have parenthesis: if(($value = $sanitizer->name($input->get->type)) && in_array($value, $allowedTypes)) $input->whitelist('type', $value);1 point
-
You don't need to create a new template for that unless you want to. It uses the default admin template, and the login form is created by the ProcessLogin module. The best place to modify it is probably in your admin theme's custom stylesheet. It's also possible to create a login form anywhere on your site (like on the front-end) and just use the $session API functions to authenticate the user. But if your intention is to create an admin theme, then it's best to let the existing one stay and customize it from the stylesheet.1 point
-
Soma, this is totally different: I have build voting application (used for elections etc), where I save each vote as page. There are different kind of voting mechanisms, since in some elections each voter can give something like 40 votes. So if I have 300 people voting, it can create 300 * 40 = 12 000 votes. What I need in this situation is those 300 voters, not all those votes. All this data needs to be real time, so no use of any kind of cache. Also the original problem was that I was running out of memory, so no cache help here. Sorry for being mysterious about my use case - I tried to simplify it, but ended up complicate it for you guys... I got this working nicely, this is what I ended using (basically stripped down from Ryan's example SQL): SELECT ref_page.id FROM pages JOIN field_v_voter AS ref_field ON ref_field.pages_id=pages.id JOIN pages AS ref_page ON ref_field.data=ref_page.id WHERE pages.parent_id='$id' GROUP BY ref_page.id; In this case I have 4500 votes and 244 voters. It doesn't even blink an eye to load, even if I end up loading each of those voters. It was pretty much opposite resolution when I tried to load those 4500 pages in memory and then those 244 in addition... Also, this was very helpful to see, that it won't be that bad or mysterious if you need to get into sql level here. In simple cases like this it won't be that difficult sql after all. Although now it seems clear that in this particular application it would have been much better idea to use custom table instead of pages. SQL would have been this: SELECT voter_id FROM votes WHERE election_id='$id' GROUP BY voter_id; Also it might be nice idea to add "who has already voted" table to keep those ID:s. Thanks guys again!1 point
-
Direction: $events = $page->siblings->remove($page)->find("limit=3");1 point
-
This is the way to create template and fields with API: // new fieldgroup $fg = new Fieldgroup(); $fg->name = 'new-template'; $fg->add($this->fields->get('title')); // needed title field $fg->save(); // new template using the fieldgroup $t = new Template(); $t->name = 'new-template'; $t->fieldgroup = $fg; // add the fieldgroup $t->noChildren = 1; $t->save(); // add one more field, attributes depending on fieldtype $f = new Field(); // create new field object $f->type = $this->modules->get("FieldtypeFloat"); // get a field type $f->name = 'price'; $f->precision = 2; $f->label = 'Price of the product'; $f->save(); // save the field $fg->add($f); // add field to fieldgroup $fg->save(); // save fieldgroup All pretty much standard OO one can figure out looking at core and PW modules. But not someone unexperienced would figure out by themself. I think at some point we need to cover these in a documentation.1 point
-
You can assign fields to templates like this: $template = $templates->get("some_template"); $template->fields->add("newfield"); $template->fields->save(); this code is taken from here http://processwire.c...bles/templates/ So, just make an array with all the templates you want the field to be on, and go for it $ts = array("home", "basic-page", "search"); foreach($ts as $t){ $template = $templates->get($t); $template->fields->add("newfield"); $template->fields->save(); } EDIT: the field will be on the last position of each template1 point
-
Hey neil (are you neil?), I'd say go check out the source of configurable modules. The code for building the configuration options is there - you'd only save the fields into db: // this is a container for fields, basically like a fieldset $fields = new InputfieldWrapper(); // since this is a static function, we can't use $this->modules, so get them from the global wire() function $modules = wire('modules'); // Populate $data with the default config, because if they've never configured this module before, // the $data provided to this function will be empty. Or, if you add new config items in a new version, // $data won't have it until they configure it. Best bet is to merge defaults with custom, where // custom overwrites the defaults (array_merge). $data = array_merge(self::getDefaultData(), $data); // showModal field $field = $modules->get("InputfieldCheckbox"); $field->name = "showModal"; $field->label = "Use modal window"; $field->description = "Whether open pages in modal (overlay) window or goes to traditional administration."; $field->value = 1; // providing a "checked" value for the checkbox is necessary $field->attr('checked', empty($data['showModal']) ? '' : 'checked'); $fields->add($field); return $fields; This is from latest AdminBar by @apeisa. You can see the '$field' part, where the field is built. You probably only run $field->save() at the end instead of current $fields->add() and you have just created field via code Adding fields to the template will be probably close to the ->add() call, and I'm totally not sure about reordering them in the templates via code, you might need to play with this a little.1 point
-
The existing comments module does keep the user ID already, though it doesn't use it for storing the user name. But you could make an autoload module that changes the 'cite' property of a comment to the user name. This is something that has to be done at runtime since a user's name may have changed since the comment was posted. public function init() { $this->addHookAfter('FieldtypeComments::wakeupValue', $this, 'hookWakeupValue'); } public function hookWakeupValue(HookEvent $event) { $value = $event->return; foreach($value as $comment) { if($comment->user) $comment->cite = $comment->user->name; } } To have the comment displayed instantly, that will be easier to solve, and doesn't require modifying the existing module. Just do your comments processing/output generation before you "echo" any output. When a comment is posted, do a $session->redirect('./'); I'm making a page-based comments module which will have the same sort of flexibility as the rest of ProcessWire, though it'll be a bit before I've got it finished (and some projects have to come first). But this page-based comments module should support nearly anything you could want to do with it, without having to modify its core code.1 point