-
Posts
1,489 -
Joined
-
Last visited
-
Days Won
43
Everything posted by gebeer
-
@cstevensjr I partly agree with you. And again thanks to @flydev for providing the precompiled version. But in a way this defeats the purpose of a sass based site profile.
- 39 replies
-
- responsive
- bootstrap
-
(and 3 more)
Tagged with:
-
@Jim_Chapman Thanks for posting here. In the meantime my client has decided to go with native apps and we already have developers for the project.
-
@flydev Thanks a lot for putting this together. I was only waiting for BS4 to reach beta state before I will update my site-pwbs profile. Now I don't need to spend the time on it myself, which is great @pwired @cstevensjr I can only recommend to preprocess yourself and encourage you to look into node, compass, bower etc. It really is worth the effort and gives you so much more flexibility. With the precompiled version of this profile, you need to override a lot of stuff in your own CSS and this will bloat your code.
- 39 replies
-
- 3
-
- responsive
- bootstrap
-
(and 3 more)
Tagged with:
-
Not to forget ST3 SFTP and Sublimerge plugins. They cost little but bring huge benefits to my workflow
-
Out of interest, who's using Less/Sass vs plain old CSS
gebeer replied to onjegolders's topic in Dev Talk
Just wanted to throw PostCSS into the discussion. Seems to be the way to go for me. I've been working with SASS for the last 2-3 years now. With PostCSS it is easy to integrate my SASS workflow and further enhance it with PostCSS plugins like autoprefixer, media query packer, minification etc. So you don't really need to change your workflow and get to optimize output of your CSS. Here are 2 great articles that helped me with the conversion from native SASS compiler to SASS+PostCSS+gulp. After all I believe that CSS optimization and minification should be done on the client side. Preprocessors can assist here. And even concatenation will soon be a relic of the past when HTTP/2 fully hits the scene. benbyf has a great blog post with performance comparison http/1.1 vs http/2. -
@iNoize getting comments is not implemented in the module. One would have to extend the module code to call the comments endpoint for every media object. Sorry, but I don't have the time for this right now.
-
I have a setup where users can enter some Hanna Code in the editor which will be replaced by a gallery that contains all images on that page or a chosen number of images. This is my Hannacode PHP <?php $images = $page->images; // name of your images field if ($images->count) { $config->scripts->add($config->urls->templates . "bower_components/fancybox/source/jquery.fancybox.pack.js"); $config->styles->add($config->urls->templates . "bower_components/fancybox/source/jquery.fancybox.css"); $showcount = ($show == "all") ? false : $show; $gallery = "<article class='gallery row'>"; if($showcount) $images = $images->find("limit={$showcount}"); foreach ($images as $i) { $thumb = $i->size(300, 300); $desc = ($i->description) ? $i->description : $page->title; $gallery .= "<div class='col-md-4'> <div class='thumbnail'> <a class='fancybox' rel='group' href='{$i->url}'> <img src='{$thumb->url}' alt='{$desc}'> </a> <p class='caption'>{$desc}</p> </div> </div>"; } } $gallery .= "</article>"; echo $gallery; Hanna Code to insert into the editor: [[gallery]] // shows all images [[gallery show=6]] // shows first 6 images Settings in Hanna Code module With this solution users cannot choose the images for the gallery from within CKEditor but it takes images from the images field of that page. This should get you started. Obviously you'd need to adjust script paths and markup (I'm using Bootstrap 3 here)
-
Interesting solution, indeed. But it feels a bit hacky. I'd rather present a different menu layout to mobile devices as to avoid the hover problem in the first place. Something like off canvas or the likes.
-
Out of interest, who's using Less/Sass vs plain old CSS
gebeer replied to onjegolders's topic in Dev Talk
Susy is totally great. It might have a bit of a steep learning curve at the beginning. But once you have wrapped your head around it, it is a pleasure to use and the most flexible grid solution I have encountered so far. There's a ton of great resources out there that can help to grsp the concept. Good starting point: http://zellwk.com/blog/susy2-tutorial/ Flexbox is definitely worth exploring. Recently I discovered https://flexeble.space/ which is a flexbox grid with inline-block fallback for >= ie9. But since everything can be accomplished with Susy and browser support for flex is not yet fully there, I prefer to wait until it is nativel;y supported in Susy. And there seem to be good reasons why you shouldn't use flex for overall page layout: https://jakearchibald.com/2014/dont-use-flexbox-for-page-layout/ -
I'm using it for all my development work. Makes setting up dev environments so much quicker and easier. No more manual installation of LAMP stack in my Linux box or fighting with WAMPP/XAMPP settings. I have one vagrant box that hosts all of my PW projects. Then I have one that brings all I need for a Drupal project. My main box is a remnant from the days where I was mainly doing Joomla projects. But it still works quite nice: https://github.com/joomlatools/joomlatools-vagrant One of these days I want to put together a box solely for PW with wireshell etc. Just didn't have the time to pull it together. Bernhard put a nice box together with some scripts for automatic PW installation and DB backups: https://github.com/BernhardBaumrock/vagrant-pw-lamp
- 28 replies
-
- 4
-
- vagrant
- virtualbox
-
(and 1 more)
Tagged with:
-
Hello, I need to restrict the page view of my app to a single guest user. This means if a session for user guest is already open for that page, other guest users are not allowed to view the same page. $session doesn't help much in that case as far as I can see from the docs (or maybe $session->getHistory() can help?). I think I could approach it this way: 1. Set session storage to DB 2. Query session table in DB for open sessions for that page and act accordingly Is there anything built into the API which I have missed that I can utilize to query the session table? Or would I have to use $database and build my own query? Any insight on this or idea how to tackle the problem would be much appreciated.
- 1 reply
-
- session
- guest user
-
(and 1 more)
Tagged with:
-
As far as I know, there is no limit on the API side. You can create 100s or 1000s of pages. I think what happens in your case is that the max execution time for your script is reached at some point in your loop. This max value depends on your server settings. But you can change it runtime by using ini_set('max_execution_time', 300); ( would be 300 seconds for each iteration, which is just an example value) inside your loop and this will reset the execution time for each iteration in your loop. See here for more info.
-
When processing your form, you need to upload the image to a temporary folder first, before you can add it. Here and here are working examples. The important parts in that code is WireUpload, which saves the images to the temporary $upload_path. From the examples you can also learn how to utilize the PW form API to do error handling etc. Hope this helps.
-
@iNoize To make a call, you need to have the module installed and gone through the process of generating your access token (which is desribed in the module howto). Then you can make calls from anywhere in yoru templates: $instagram = $modules->get('InstagramFeed'); // load the module $userMedia = $instagram->getRecentMedia(); // get media of your user Then you should have a look at the PHP example to see how you can access values inside $userMedia. $userMedia is just an example name. You can call that whatever you want. in the PHP example it is called $feed. $feed is an array of the media for that instagram user. You need to loop through that array in a foreach to access the contained media items and extract their properties for display.
-
To retrieve tagged media with $media = $modules->get('InstagramFeed)->getRecentMediaByTag('mytag') I had to add scope=public_content to the url for getting the code in the getCode() method: $request = array( 'client_id' => $this->clientId, 'redirect_uri' => $redirect, 'response_type' => 'code', 'scope' => 'public_content' ); After that I had to click the 'get Access Token' link again and renew the permissions for the app. Otherwise I always received an empty result. In the Instagram API docs they state that the public_content scope is required. With the module as is now, it only gets the basic permissions in the getCode() method by omitting the scope parameter. (more about scopes in the API docs) Can anyone confirm that they have successfully received results for the getRecentMediaByTag() call without adding scope=public_content to the 'get Access Token' link url?
-
I think, PW is not just using strtotime() to convert the relative date to a timestring. You can take a look at wire/core/WireDateTime.php, to see how strings are converted to timestamps. It is also worth looking into the $datetime class and see how you could utilize that. But, this doesn't really answer your question why it is that you are getting different results. I would also expect to get the same results. Only thing I can think of is time zone conflict. Maybe your strtotime() operation is using a different time zone than the internal PW calculations? But this is just a wild guess. To see if this is the case, you could try and use date_default_timezone_set() before using strtotime() and getting the pages.
-
My app is kind of a social wall that is running for days/weeks on end and I would like to automate the retrieval of a new access token. Problem: we never know when Instagram might decide to revoke the access token. Once the old one has been revoked, the Instagram API will return error_type=OAuthAccessTokenError. Whenever the response contains this, I would like to generate a new one automatically and save it to the module settings. Looking at the getCode() method, it requires superuser priviliges to get the access token because the redirect URL for getting the code from Instagram lies within the PW admin. So I tink I need to provide a publicly accessible redirect URL to handle the process of aquiring the new access token. Am I heading in the right direction here? (Sorry if this may sound like a silly question. But it is the first time for me working with the Instagram API). EDIT: Sorry, I should have read through the module code more carefully. I think, all it takes to automate retrieval of new access token is modifications to 1. sendRequest method to handle authorization failure and get the new accesstoken 2. getCode method to allow handing back the URL for code retrieval when not logged in as superuser 3. have a module setting to cater for automatic update of access token I will give it a shot and report back here how it goes. 2nd EDIT: After doing quite some digging and reading carefully through the Instagram API docs and usage policy, I found that the API is not supposed to be used for automated aquisition of access tokens the way I was originally planning it and the way I can do it eg with Twitter API. Instagram is pretty restrictive and they clearly state in their Platform Policy Various sources state that their access token has been working for quite a long time (up to 3 years). So I don't worry too much about the access token being revoked during the time my social wall will be up. Anyways, I will cater for the rare case that the access token is invalid at some point in time. I will extend this great module so that the superuser gets notified by email when authentication problems occur during requests to the API. Then they can do a manual refresh of the access token through the link in the module admin interface.
-
Output pure JSON for ajax calls in process module
gebeer replied to gebeer's topic in Module/Plugin Development
Thanks, Martijn, for looking into this. It was a really stupid mistake on my side that caused the problem. Code in #2 is working fine. -
Output pure JSON for ajax calls in process module
gebeer replied to gebeer's topic in Module/Plugin Development
The code in #2 works fine on a 3.0.12 install. But the same code in a 2.7.2 install returns not only json_encode($out) but the whole page markup. So I am back at where I was when I originally posted this. How can I get back only what I return from my function in #2 without all the markup of the admin theme? Forget about it - Its getting late here. All working fine. -
Hello, I installed this module on a 3.0.12 devns site despite the fact that it is officially not compatible (yet?). And it broke my backend theme which is a custom admin theme based on the default theme with only very slight changes to the theme header and the content width. I needed to manually delete my custom admin theme from the modules table in the DB to get a working backend again. Finally, I downgraded the site to 2.7.2 so I can use the twitter markup module. Site is still under development and I don't really need all the new features from devns branch. Has anyone else experienced problems with this module on 3.0.x?
-
@SiNNuT thanks for the input. I just ran into this while testing and set the limit value to 100, 200 and 300 just to see what happens. I will definitely limit the pages for the life site.
-
I just tested and it is doing exactly what you imagined and I need. Thanks again! EDIT: forgot to mention that it also is much faster
-
Thank you for the suggestion. With something like $oldPosts = wire('pages')->find('template=post, shown=1, limit=16, sort=random') would PW get the first 16 pages it finds and then sort them randomly or would it go through all post pages and get 16 randomly selected pages? I'd need the latter.
-
Hello, Getting random pages with $oldPosts = wire('pages')->find('template=post, shown=1, limit=100')->findRandom(16); works fairly good. About 500ms But without the limit=100 it takes more than 6 seconds. There are only 60 pages with template post but it will be thousands when the app is live. Is there a more efficient way of getting random pages?
-
Output pure JSON for ajax calls in process module
gebeer replied to gebeer's topic in Module/Plugin Development
It turns out that there is no need for special setup except for setting the right header type. My execute function looks like this and returns pure JSON: public function ___executeAjaxControl() { // handle banword saving if($this->input->get->banword) { $banword = wire('sanitizer')->text($this->input->get->banword); if(wire('pages')->get("template=banword,title={$banword}")->id) { $out = "Stoppwort existiert schon"; } else { $b = new Page(); $b->template = 'banword'; $b->parent = wire('pages')->get('template=banwords'); $b->title = $banword; $b->name = wire('sanitizer')->pageName($banword); try { $b->save(); } catch (Exception $e) { $out = "Es trat ein Fehler auf:{$e->getMessage()}.Bitte erneut speichern."; } if($b->id) $out = "Stoppwort {$b->title} wurde gespeichert"; } } header('Content-Type: application/json'); return json_encode($out); } @admin: I can't mark this as solved