Leaderboard
Popular Content
Showing content with the highest reputation on 05/11/2017 in all areas
-
I think you need to save the new page before adding the repeater item to it. $p = new Page(); $p->parent = wire("pages")->get("template=something"); $p->template = 'some-template-name'; $p->name = 'some-name'; $p->save(); // save the page here $r = $p->repeater->getNew(); $r->field1 = 'somthing'; $r->field2 = 'somthing'; $r->field3 = 'somthing'; $r->save(); $p->repeater->add($r); $p->save(); // save again after adding the repeater item4 points
-
Hi @bramwolf, That's an interesting project you have because some of the items you list are what I am currently working on. I am rebuilding my site from the ground up to accommodate some of these items, so it's appears to be duplicating your project. I don't want to hijack your thread, but I will pass along what I am going through. - The dynamic content for news articles, company profiles, and the like, is easily handled by ProcessWire. You won't have any issues there. - The way I am approaching your membership requirements is that each user must register, which grants them read-only rights to view my applications (your free membership item). Then a user may select one or more applications to subscribe, which elevates their rights to administer the selected applications (additional user licenses, subscription payments, reporting, etc.). I changed the login to use an email address rather than a user name because I don't want Peggy Sue in Ohio colliding with Peggy Sue in Florida. - There are any number of solutions available that handle advertising for web sites, such as openx, google ads, doubleclick, revive, etc. However, ad blockers can limit these. I wrote a wp plugin many years ago to handle advertising that I am now porting to ProcessWire. I'm in the deep end too considering I am learning how to incorporate some of my older code into the ProcessWire way of doing things. - Your job listing also falls under the dynamic content. - The marketing automation can be done through cookies. Tracking user interest on your client's site is simple enough by storing elements. The issue comes later when you analyze that data. Adding unique ids to targeted emails will also let you track user responses. Hope this helps, and good luck to you.3 points
-
Hello Bramwolf, As Processwire is a CMF it can do all of these. However it will require quite a lot of custom coding. If you aren't looking to do that, then you will have to use multiple platforms. Getting them to all work together, could prove a nightmare and blow your house down. For the CMS part, you could use ProcessWire and for the membership part you could also use ProcessWire and Stripe/PayPal quite easily. Personally I would suggest Stripe. Advertising platform you can use something like https://www.adbutler.com/ and plug that into ProcessWire, and for Marketing Automation you can now use something like https://mailchimp.com/features/marketing-automation/. The thing that I'll have no idea about is segmenting you users based on personal interest, pages they have visited etc. To me that will be your biggest bulk of work as to track all of this is big data and will require crazy optimisation or a huge database.3 points
-
i came up with this solution today: WARNING: your site/config.php should NOT be writable by your php user, so you would have to be careful about file permissions: https://processwire.com/docs/security/file-permissions/ usage: updateConfig('/path/to/your/site/config.php', [ 'httpHosts' => ['domain1.example.com', 'domain2.example.com'], 'dbName' => 'my_db', 'dbUser' => 'my_db_user', 'dbPass' => 'my_db_password', ]); function: /** * update config file */ function updateConfig($file, $options = []) { if(!is_file($file)) return 'file not found'; $content = file_get_contents($file); // loop all set options foreach($options as $key => $val) { $search = '/\$config->'.$key.'(.*);/'; if(is_array($val)) $replace = '$config->'.$key.' = array(\'' . implode("','", $val) . '\');'; elseif(is_int($val)) $replace = '$config->'.$key.' = ' . $val . ';'; elseif(is_string($val)) $replace = '$config->'.$key.' = \'' . $val . '\';'; else return 'value must be array, integer or string'; $content = preg_replace($search, $replace, $content); } return file_put_contents($file, $content); } maybe it helps someone2 points
-
Don't know if it still functions: https://github.com/Da-Fecto/LimitChildren/blob/master/LimitChildren.module2 points
-
@MaryMatlow, see the sort() method. function bsRenderPortfolio($portfolio) { $portfolio->sort('my_field_name'); // insert the name of the category field you want to sort by // ... }2 points
-
I feel you on number 9 (number 9, number 9) . It's been a while since I've used Linux in earnest, and it was the impossibility of getting a functional music production setup that was the nail in the coffin. Funny thing is that while desktop Linux never really caught on with the general public, it spoiled me for things like real virtual desktops and multi-tab file browsers WAY before they came to Mac/Windows. I'd recommend Bitwig Studio or Renoise, both of which have native Linux support and will run VST plugins compiled for Linux. At least on Mac/Windows RME is known for best-in-the biz-hardware, drivers, and low latency performance, not sure about Linux (especially if FireWire). I use Mac at home, Windows 7 at work, and would be happy to use a stable Linux again for development. Each OS has its flaws and strengths. I try to use cross-platform tools as much as possible (Sublime or Visual Code and MAMP/MAMP for Windows) to minimize mental gear-shifting.2 points
-
Oh wow, it works! :-D Did I already said pw have the best community? ;-) For posterity, it put the final version of my news template (without markup) based on @Sérgio with some modifications. I add start=0 on recent news, so they will not paginate. The list of 10 is then updated at each loading by the button. Maybe (probably) not best optimize, but it works! @szabesz yes, ajax works fine. I use intercooler to facilitate my lacking knowledge. if($config->ajax) { //Ajax output $recent_items = 3; $limit = 10; $news = $pages->find("template=news, parent=1027, limit=$recent_items, sort=-publish_from, start=0"); //3 most recent news $news2 = $pages->find("template=news, parent=1027, limit=$limit, id!=$news, sort=-publish_from"); //Next 10 foreach($news2 as $new) { //markup } $children = $page->children("limit=" . $limit); $totalpages = ceil($children->getTotal() / $limit); if ($input->pageNum) { if ($input->pageNum < $totalpages) { $content .="<li ic-append-from='" . $page->url . $config->pageNumUrlPrefix . ($input->pageNum + 1) . "' ic-trigger-on='scrolled-into-view' ic-target='.liste' ic-indicator='#indicator'>Next"; } } // Main output $recent_items = 3; $limit = 10; $news = $pages->find("template=news, parent=1027, limit=$recent_items, sort=-publish_from, start=0"); //3 most recent news $content .= "<div id='featured' class='liste'>; foreach($news as $post) { //Markup for featured news } $news2 = $pages->find("template=news, parent=1027, limit=$limit, id!=$news, sort=-publish_from"); //list of 10 $content .= "<div id='listing'><ul class='style2'>"; foreach($news2 as $post) { //Markup for listed news } $totalpages = ceil($news->getTotal() / $limit); if ($input->pageNum) { if ($input->pageNum < $totalpages) { $content .= "<li><button class='btn btn-default' ic-get-from='" . $page->url . $config->pageNumUrlPrefix . ($input->pageNum + 1) . "' ic-target='closest li' ic-replace-target='true'>Load More... <i class='fa fa-spinner fa-spin ic-indicator' style='display:none'></i> </button></li>"; } Thanks! Mélanie2 points
-
Just a note about CI: I believe that the next version (4?) will be quite different to the current version, but will be familiar enough for those familiar with CI. Laravel is quite easy to learn, but I would suggest taking a course on PHP so you use a framework well.1 point
-
Update: I'm not sure why but the failure to render the page properly must have been due to an error in my code somewhere; pw-append works exactly as above with single quotes or double quotes.1 point
-
I have in the past, eye gouging moments again. Studio One 3 is my DAW of choice but I'll have a look at LMMS, thanks. RME drivers are astonishing, USB latency is like sorcery, don't know how they do it! The problems in Linux are mostly with VST plugins written just for OSX/Windows. I think I love/hate Linux at the same time, open source is great, but too many cooks can spoil the broth. Instead of fixing things and working together, devs seem to just 'fork' something into something similar (read: the same, but blue this time). Choice is great, but for me, Linux is like a beautiful guitar that doesn't stay in tune, you'd LOVE to play it and use it all the time, but you just know deep down that the old trusty one in the corner is more productive, less annoying and gets the job done much quicker. I think a big plus for (modern) Linux is how good it looks, budgie desktop & elementary OS are the gold standard and IMHO look and feel better than both OSX and Windows. They've done away with the old fashioned looking huge red cross/green tick combos and the other dated looking UI elements that still lurk in most distros. Moaning aside, I'll always have a drive dedicated to it in my rig! Just about to try a few distros now as it happens1 point
-
I can't write a working example yet (on mobile) but if you're comfortable with hooks, you can hook into Page:addable and return false (change $event->return) or throw error when the page ($event->object) has more than 2 parents ($page->parents->count)1 point
-
I don't use any of them, so I can't really comment. Studio One however looks a lot like FruityLoops to me, which I had on Windows. An alternative I used for Linux was LMMS. I'm not sure if you're tried it, but it can be found here: https://lmms.io/ As for Manjaro, I much prefer it over Ubuntu. Changing the Kernel version is a breeze, as is switching between display drivers. On the occasion I've messed things up, I've managed to solve it by reading through the docs. If you can't find what you're looking for there, just head over to the Arch website for answers, as Manjaro is just Arch with some nice additional features on top. I've spent many years trying to find my perfect OS, and Manjaro seems to be it. Sure there are things that I need Windows for, like my printing and cutting software, but I'm always amazed to find open source alternatives. But yeah, let's relive the Amiga years and all our problems will be solved1 point
-
Ditched windows 2000 in '04 for *nix and never looked back. Desktop is ubuntu, servers are freebsd and debian. As far as the software goes, I have only been limited to windows by certain companies that won't develop on anything but windows. Those are specific to my previous employment though, so I don't care. @SamC, Have you looked at ardour? I haven't used it in a while but does run on linux and did what I needed at the time. I also use musescore for printed versions.1 point
-
Try this (not tested): $recent_items = 3; $items_per_page = 10; $most_recent_news = $pages->find("template=news, parent=1027, limit=' . $recent_items . ', sort=-publish_from"); //3 most recent news foreach($most_recent_news as $post) { ///markup } $news = $pages->find("template=news, parent=1027, 'id!=' . $most_recent_news . ', limit=' . $items_per_page . ', sort=-publish_from"); //List of next 10 foreach($news as $post) { ///markup } echo $news->renderPager(); //render pagination1 point
-
At the moment the endpoint just returns: id, name, timezone, start_time, end_time, description. But it's pretty easy to get the information about the place and cover. I updated the module to include it as well and updated the Graph Api Version to 2.9. `$modules->get('FacebookEvents')->getEvents()` returns now the following data: array(1) { [0]=> array(6) { ["id"]=> string(15) "123123123" ["name"]=> string(3) "xxx" ["timezone"]=> string(13) "Europe/Berlin" ["start_time"]=> string(24) "2017-06-23T16:00:00+0200" ["end_time"]=> string(24) "2017-06-23T18:30:00+0200" ["description"]=> string(3) "foo", ["place"]=> array(3) { ["name"]=> string(5) "Venue" ["location"]=> array(6) { ["city"]=> string(7) "Berlin" ["country"]=> string(7) "Germany" ["latitude"]=> float(xx.3321915) ["longitude"]=> float(xx.3735704) ["street"]=> string(17) "Street 14" ["zip"]=> string(5) "01234" } ["id"]=> string(15) "123123123" } ["cover"]=> array(4) { ["offset_x"]=> int(0) ["offset_y"]=> int(85) ["source"]=> string(148) "https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/..." ["id"]=> string(16) "123123123" } } } Having a quick look at the Graph API documentation, using the event ID one could send another request to get even more data. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api/reference/event/.1 point
-
This is because the module extends Fieldtype Textarea but removes certain config inputfields (including contentType) that are not to be used with Fieldtype YAML. I'm guessing that the core Fieldtype Textarea has added an inputfield dependency for contentType since the Fieldtype YAML module was created, hence the warning. @owzim, maybe the module could set the unused config inputfields to hidden rather than not including them in the field config at all? foreach($parentInputfields as $inputfield) { if(in_array($inputfield->name, $forbidden)) { $inputfield->collapsed = Inputfield::collapsedHidden; } $inputfields->append($inputfield); }1 point
-
Hey there! I find myself discovering more and more beauty when working with ProcessWire. this render method is also new for me. Thank you a lot for sharing this.1 point
-
OK, I think I know what the problem is. SessionCSRF.hasValidToken() doesn't use the argument passed to $form->processInput() to get the CSRF token. It references $input->post no matter what was passed to processInput(). And with an AJAX request $input->post is empty; it seems like it should use the argument passed to $form->processInput(). (Actually, it checks for extended HTTP headers when it's an AJAX request but if they aren't present it then directly references $input->post.) The solution is to set an HTTP header X-tokenname where tokenname is the CSRF token name and the value for the header is the CSRF token value. It's odd the $form->processInput($arg) does take field values from $arg but it doesn't take the token from $arg and instead directly references $input->post.1 point
-
I think it's a great idea - I have added to my list. In the meantime I have added a new "Custom PHP" panel which lets you return anything you want. which results in: Not very pretty looking I know - I am sure @tpr will have some style suggestions for me This is obviously not the best solution for things like page speed because it won't work with local dev sites, so as I said, I will work on dedicated panels for those, but this still may be helpful until then, and perhaps also for other things. Some other significant recent updates that I haven't mentioned. There are now separate default panel config options for frontend vs backend The User switcher now lets you logout (while maintaining the session and access to the Tracy debug bar). Until recently, you had to switch to a different user before the logout would work properly.1 point
-
I just wanted to add my approach of using a static method on my extended multisite module together with a cached list of domain names: https://github.com/LostKobrakai/MultisiteExtended/blob/master/MultisiteExtended.module#L341-L3641 point
-
I got the same problem, having a slider (carousel) with the first N pages, then the rest are listed below that (and paginated). Using "start" screwed things up. However, getting pages to exclude first and then building up the pages to paginate worked: $carouselItems = 2; $itemsPerPage = 5; // get page IDs to exclude $carouselItemIDs = wire('pages')->find('limit=' . $carouselItems . ', sort=-publish_date')->id('|'); // get pages for pagination (without carousel pages) $myPages = wire('pages')->find('id!=' . $carouselItemIDs . ', template=recipe, limit=' . $itemsPerPage . ', sort=-publish_date');1 point