cb2004
Members-
Posts
578 -
Joined
-
Last visited
-
Days Won
3
Everything posted by cb2004
-
Here is some example XML <?xml version="1.0" encoding="utf-8"?> <branches> <branch> <properties> <property> <bullet1></bullet1> <bullet2></bullet2> <bullet3></bullet3> <bullet4></bullet4> <bullet5></bullet5> <bullet6></bullet6> <bullet7></bullet7> <bullet8></bullet8> <bullet9></bullet9> <bullet10></bullet10> <bullet11></bullet11> <bullet12></bullet12> <bullet13></bullet13> <bullet14></bullet14> <bullet15></bullet15> <bullet16></bullet16> <bullet17></bullet17> <bullet18></bullet18> <bullet19></bullet19> <bullet20></bullet20> </property> </properties> </branch> </branches> Without testing your code would just increment the counter in every property, and not every bullet. I am doing each one per line for now, but still wondering how to get this down to a few lines.
-
Hi all, I think I have been looking at this too long and I am sure it is so simple. I am reading an XML file and it contains bullet points 1 to 20. Here is example code: foreach($xml->branches->branch->properties->property as $property) { if($property->bullet1 != '') $bullets .= "{$property->bullet1}\n"; } That would read the first bullet point, and then we have $property->bullet2 etc etc. Obviously I could list all 20 like that and just go with $p->myField = $bullets but how would I make this into less code. I was thinking of a foreach within the above foreach foreach(range(1, 20) as $bullet) { $li = '$property->bullet' . $bullet; $bullets .= $li; } And lots of variations of but thats drawing a blank. Cheers as always people.
-
I can confirm this issue.
-
I am terribly bad at Ajax, I don't mind admitting it. Where would I start with picking a select in the form and then loading the children in another select on the form until there are no more children. @kongondo is this something https://processwireshop.pw/plugins/dynamic-selects/ can do? If yes sign me up.
-
I wouldn't explore multi-site anymore. You could spit out a feed from site A and read it on site B. You could even import them into site B. I am on mobile right now, but we do this quite regularly so could post an example when I am in the office. RSS, XML, lots of options.
-
Files field returning null unless I use getUnformatted
cb2004 replied to adrian's topic in General Support
Could this be related? This is an image field set to have just 1 file. Will try getUnformatted when I get a mo. -
So I have this working using: $session->redirect($page->file->url); However I tried using $http->sendfile and $files->send as I thought they would be better but they didn't work. Any thoughts?
-
Hey @Macrura, so glad you are taking this on. Agree it is stable, just needs a little love. In the fork made by @gebeer this supports the regions US and EU, would be great if you could get this into your fork.
-
Perfect, thanks so much Robin.
-
I am coming up against a bug where I cant make use of the functionality 'Name format for children', and it doesn't seem like a hook is possible to save the name: $wire->addHookBefore('Pages::setupNew', function(HookEvent $e) { $page = $e->arguments(0); if($this->input->parent_id === '1') { $page->name = 'some-name'; } }); I have tried many solutions from the forums, nothing is achieving what I would like, even for example if I am trying it on the home page like the code above. Any help would be much appreciated.
-
Users::saveReady working in ready.php but Users::added is not
cb2004 replied to cb2004's topic in General Support
Yep, my bad. awesome job on that one. I just had to change 'template=user' to 'template=46' or 'template=members-detail' as my users are not within the normal section for this site. -
Users::saveReady working in ready.php but Users::added is not
cb2004 replied to cb2004's topic in General Support
Nice thinking Bernhard but no joy. In my case I may have to get users added through the frontend anyway. Creating a name for a user is an unnecessary step for me so people will be adding an email address for the name, and then when the user is added they will be adding the email address again to the email field. Off topic I know but just in case I revisit this thread in years to come. I will do that, cheers. -
Users::saveReady working in ready.php but Users::added is not
cb2004 replied to cb2004's topic in General Support
Yep, that's why I was expecting it to work and banging my head against the table when it didn't. I tried hooking into Pages::added but: Method Page::addRole does not exist or is not callable in this context -
I am having a lot of fun with the users in different parents/templates: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users What I would like to do is when a user is added using my new user template it should automatically add the role, this field can then be hidden. I can get the hook to work in ready.php using 'saveReady' but not 'added'. Any ideas? $this->addHookAfter('Users::saveReady', function($event) { $user = $event->arguments(0); if($user->template->id === 46) { if($user->get('_is_saving')) return; $user->setQuietly('_is_saving', true); $user->addRole('member'); $user->save(); $user->setQuietly('_is_saving', false); } });
-
So, I followed the steps here to have users in a different parent: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users This is working great, however when an editor adds a new user to '/members/', I don't want them to have to enter a 'Name'. This is completely irrelevant to the system I am building and will just require an email, so I was going to populate the name from the ID, or the email address entered havent decided yet as its not important, people will login on the frontend with their email. The trouble is, if I populate 'Name format for children' in the parent template nothing works when I go to add a new member, it goes to a 404. Is there any way to skip the adding of a name here? Cheers.
-
Interesting concept, you could offer a license for the people that did fund you and it will give you some enthusiasm, but may of course hold you to deadlines, ha ha. Putting my cards on the table, I am not sure if I would ever use Padloper, I would love to but the need hasn't come up yet. The only thing I like about WordPress is the speed you can get WooCommerce to market. However I probably would Kickstart it as I know it would make a great addition to PW. There may be many like me, so if you offer up the license to people who do fund, you are not missing out on anything, only they are if they don't use the license. Great thinking HMCB.
-
All valid points. But in my eyes if @ryan is confident that the current "work in progress" is better than the current "live" is there any harm in pushing? If new visitors see better than what is currently there surely that will gain new users in the interim. Feedback can then be received and implemented to make it even better and boost new users even more. The website is looking tired as it is, and with so many opinions, when would something that everybody is happy with (is that ever the case) actually go live? Happy New year to everyone, it's been a great year with ProcessWire in our small team.
-
Make page stick to the bottom of the page tree
cb2004 replied to Michael van Laar's topic in General Support
+1 -
That done the trick, I had to turn off cleaning for things like ?utm_source=X&utm_source=Y. What caught me out here was page:1000{all} didn't work, fine once I realised though.
-
Same, I will certainly be purchasing.
-
Can the module redirect to destination including query strings or anything after the / for example? I have tried numerous things but no joy. Having to do this in .htaccess: RewriteRule ^old-page/(.*) /new-folder/new-page/$1 [L,R] Cheers.
-
Same issue. Latest dev doesn't help.
-
New site looking great, nice and clean. Would love to lend a hand when you need it.
- 1 reply
-
- 3