-
Posts
4,296 -
Joined
-
Last visited
-
Days Won
79
Everything posted by diogo
-
Field naming, namespacing, and how we can prevent excess of fields
diogo replied to Rob's topic in API & Templates
Yeah!! At least until Ryan jumps in and kick our asses with his arguments -
Field naming, namespacing, and how we can prevent excess of fields
diogo replied to Rob's topic in API & Templates
I'm not sure if I like it, but you get a like for a great brainstorming line -
Field naming, namespacing, and how we can prevent excess of fields
diogo replied to Rob's topic in API & Templates
I thought of this many times also, and also think that in some situations a field could be used more than once in a template. But I accept the argument that the database is prepared to have only one per template and that it doesn't justify doing a big change to it only because of this. Namespacing would be overcomplicating in my opinion. Anyway, I'm with Rob here, and glad that there is this discussion again -
How about this? $array = array(); foreach($page->repeater as $r){ $array[] = <<<EOT <div> <h2>{$r->headline}</h2> <p>{$r->body}</p> </div> EOT; } foreach($page->images as $i){ $array[] = "<img src='{$i->url}'/>"; } shuffle($array); foreach($array as $a){ echo $a; } edit: the forum editor seems not to approve the heredoc sintax, and because I don't want any conflicts with it, here is the alternative way $array = array(); foreach($page->repeater as $r){ $array[] = "<div><h2>{$r->headline}</h2><p>{$r->body}</p></div>"; } foreach($page->images as $i){ $array[] = "<img src='{$i->url}'/>"; } shuffle($array); foreach($array as $a){ echo $a; }
-
Can you give a concrete example of what you are trying to achieve? What order do you want to get by mixing the arrays?
-
Ryan, this is one of those answers that should be visible outside the scope of a forum thread. I went to check how you personal blog is going, and it turns out the last post is from July 2011. How is this possible if from then on you wrote a lot of invaluable information and opinion texts on the forum??
-
Pete, you should correct echo "<h2>$artist->title</h2>"; to echo "<h2>$album>title</h2>"; Other than this, I don't have anything to add to Pete's excellent answer
-
I identified what bothers me. The globe and the photographic camera are in the same layer, to me it makes the movement less natural. Edit: somehow I instinctively expect the object to come to the mouse and not go away from it when i approach them.
-
Georgson, I'm sorry I never answered to this, somehow I din't see your tip. And now I came back to this to help here and saw it. I will check it out, thanks!
-
oh no! install successful but no pages and no login...
diogo replied to wishbone's topic in Getting Started
I also have a site hosted on Strato and in the beginning was veeery slow. I talked about this on this forum thread http://processwire.com/talk/topic/847-max-cafe-bar/, Check Georgson's answer at the end, might be useful. -
Sivutyypii sounds good to me. But not necessarily better than sivupohja. I like both
-
Slightly out of topic, just to say that this evening there is no programming. Just this https://www.youtube.com/watch?v=RVJUJF6Rg1Q
-
I must say it's a very good looking app. I installed it on fortrabbit to test. (Craft this is the former Blocks CMS, for those who are wondering)
-
true, I will change that
-
Here is a draft of the module that I talked about above <?php //ModifiedMinusCreated.module class ModifiedMinusCreated extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Modified minus created', 'version' => 100, 'summary' => 'only a rough draft', 'singular' => true, 'autoload' => true, ); } public function init() { $this->pages->addHookBefore('save', $this, 'subtract'); } public function subtract($event) { $page = $event->arguments[0]; if(!$page->fieldgroup->modifiedminuscreated) return; $page->modifiedminuscreated = $page->modified - $page->created; } Now you just have to create the integer field "modifiedminuscreated" and add it to the templates you want. edited: changed the code under Soma's suggestion
-
It works
- 11 replies
-
- data structure
- fields
-
(and 1 more)
Tagged with:
-
Your code is a mess Soma I did some corrections: public function addTitle($event) { $page = $event->arguments[0]; if($page->done) return; if($page->template->name !== "product") return; $page->title = $page->somefield . " " . $page->field2; //$page->trackChange("data"); <- is this needed? I got an error, and it worked without //} //$page->done = true; <- same goes for this //$page->save(); <- the hook is before save, so we don't need this }
- 11 replies
-
- data structure
- fields
-
(and 1 more)
Tagged with:
-
Serving different videos depending on media size
diogo replied to NooseLadder's topic in General Support
With javascript of course. You just have to be careful that the video is not switched in the middle when someone adjusts the browser window. -
Interesting discussion starting here http://forums.modx.com/thread/83112/processwire---the-new-evo
-
Welcome to the forum ezeei. The default page is home, and it can have as many children as you wish. What are you trying to accomplish exactly?
- 9 replies
-
- navigation
- children
-
(and 1 more)
Tagged with:
-
I'm in a hurry now, but try var_dumping the image and look for that info there: var_dump($page->images->first());
-
You can do this instead, and then cache it. http://processwire.com/talk/topic/2210-help-getting-a-custom-styles-php-file-working/?p=20641
-
You could also create a module that would hook to save and update a field holding the value of modified minus created. Then you could use $pages->find("modified-created>0");