-
Posts
4,314 -
Joined
-
Last visited
-
Days Won
80
Everything posted by diogo
-
Than you should use soma's solution if(!$users->get($username)){ // go ahead, add the guy } edit: but it's good that you learned the array stuff
-
Soma, maybe this could be added in the cheatsheet?
-
numChildren is returning all pages and children->count is returning only the published pages
-
This should also output the names foreach ($users as $u) { echo $u->name; } And you can put them in an array like this $names = array(); foreach ($users as $u) { $names[] = $u->name; } print_r($names);
-
My girlfriend says that I'm becoming a geek, so I won't answer this question...
-
Thanks for correcting me soma. That was a basic error, I should be more careful. shouldn't we make it obvious and just implement google search alongside the forum search?
-
Not difficult at all. The way you are doing it, the two dots are pointing one directory up, wish means that the browser is looking for a page that is at the same level then root. If you would do this for example: <a href="/disclaimer">Disclaimer</a> ...it would work on the root, but not on the other pages. To fix it, you have two options. On a non dynamic site, the option would be having an absolute link instead of a relative link: <a href="http://www.yoursite.com/disclaimer">Disclaimer</a> In PW you can do something that will allow you to change the domain of the website without breaking the link: <a href="<?= $pages->get('/disclaimer/')->url ?>">Disclaimer</a> edit: see soma's correction below for a more correct and accurate answer ↴
-
I think I missed the point of the discussion... I didn't think you were talking about tinyMCE, but the image field module, and that you were planning to add more fields besides the description field. So, what my "Why not let people add fields on the image field options?" meant was that the image field could be expanded to accept the addition of fields on the image field admin, just like a repeater. Does this make sense?
-
Alan, Ryan wrote this on the Pro Cache introduction post:
-
oh, i'm also blind... where did that parent come from?
-
hm, what about this, does it work? $menues = $pages->get("parent=/empfehlungen/februar")->children("template=empfehlung_list");
-
Manfred, look at my comment above. On Soma's code you have to change date("F") for date("n") edit: delete edit2: just for debbuging, does this work? $curr_month = $month_names[2]; // <- hardcode a number here
-
Unff gfddrh i gooug fsaw yuu iy, gdsr gfoiu?
-
Thanks for your efforts Super-Pete
-
Soma, you have an error in your code. Change: $month = date("F"); // month integer to: $month = date("n"); // month integer
-
I'm scratching my head trying to understand your code As I understand, you want to get the only month that is published, right? The intention is that the editors would publish one month and and unpublish the previous? If it's this, than I don't think it's the best way to go... But you should explain exactly what kind of effect you are trying to achieve before I start giving solutions just by guessing. because eventually 2014 will come, and you will have two Januars to deal with. You can change the selector to: $page->get('parent=/empfehlungen/ name=$this_month')
-
Module LibFlourish – Flourish auto-loader for ProcessWire
diogo replied to Adam Kiss's topic in Modules/Plugins
Is it that shelf with lots of books that look all the same in my parents house? -
Recommend a Code editor with FTP, for working on template files
diogo replied to Crssp's topic in Getting Started
This is exactly what I was looking for now , in linux I use the file manager to open the server, and I work with the files in the server exactly like with local files. -
Why not let people add fields on the image field options?
-
Module LibFlourish – Flourish auto-loader for ProcessWire
diogo replied to Adam Kiss's topic in Modules/Plugins
Encyclopaedia? What is an encyclopaedia? -
Recommend a Code editor with FTP, for working on template files
diogo replied to Crssp's topic in Getting Started
There is also a plugin for sublime text http://wbond.net/sublime_packages/sftp -
You don't have to be a PHP developer to work with PW, but what you are trying to do is not that simple. About the month, that was just an example, there are lots of possibilities to fix it. For the dates you can use all these http://php.net/manual/en/function.date.php, so you can use the number of the month for instance. So, imagine you have this structure: You could get the current month by cheking the position on the tree like this: $this_month = date("n"); //gets the number of the month "2" $this_year = date("Y"); $year_page = $pages->get("name=$this_year"); // get the page that is in the position that the current month has in the year // eq() is 0 indexed so we have to subtract 1 $month_page = $year_page->children->eq($this_month - 1); foreach($month_page->children as $child){ echo $child->render(); } Hope this example is clear
-
Hi Manfred, welcome to pw. I'm not sure I understood what you want to do, so I'm making a guess. So, right now you have this, right? If you change it to this: You could simply change your selector to get only the recommendations from January to this: foreach($page->get('name=january') as $food) Of course this would imply that someone would have to change the code every month, not ideal... What you can do, is get the current time to find out what month we are in and publish only the children of that month: $this_month = strtolower ( date("F") ); foreach($page->get('name=$this_month') as $food) Just an idea of the kind of things you can do. Of course you have to adapt it to exactly what you want. How exactly do you want this to work?
-
Do you also have a hotmail email? (just kidding, the new hotmail, that now is called outlook live, is actually pretty cool)
-
For really simple text editing this one looks good. It's lightweight and configurable. http://nicedit.com/