Leaderboard
Popular Content
Showing content with the highest reputation on 11/12/2015 in all areas
-
3 points
-
But Opauth is abandoned and now PHP-people are using HybridAuth. There is already a module, Social Login, which makes use of it.3 points
-
2 points
-
CSS awesomeness! Enter this into the "Text color" field in the module settings: transparent; width: 70px; height: 70px; border: none; background: transparent; border-radius: 100%; overflow: hidden; padding: 0; margin-right: 0.7em; color: #aaa Also set the first field value to "70,70". No matter what you write elsewhere, the code above will overwrite it.2 points
-
There are many former really great modx members out there in this wild hood... Very warm welcome to your own new journey to redefine your thinking and workflow.... Please use google to search the forums (this the only con of this forum) to get more and better information about the force of PW! Best regards mr-fan2 points
-
Thanks so much Adrian! Ok folks... just for anyone else who stumbles over here.... What I was trying to do was to use a single image field for 3 common things. The usual way would be to create 3 unique image fields. By using tags, i wanted to be more resourceful and keep it simpler by getting away with using just one image field. Now thanks to Adrian and SiNNut I have been able to do just that! What I needed... 1. Upload image/s for articles 2. Upload a single featured image for listings in other pages. Think YouTube video listings with the video thumbnails 3. Upload images to show up in an image gallery. In case 1 above, these images are untagged. In case 2 above, the desired "representative" image for the article is tagged with featured. In case 3 above, any image that is tagged with exclude will NOT show up in the image gallery. Where the problem lied originally was that if an image had more then one tag, I could not filter out what images I did not want. They all appeared! This was because I actually had an image that was both tagged 'featured' and 'exclude'. Adrian's last solution enables me to tag an image with exclude and even if the image has been tagged with something else, it still filters out the image from the gallery. Yay! Here is part of what I did.... it should provide you with enough to get the idea! foreach ($page->images as $image) { if (!$image->hasTag("exclude")) { // Adrian's Magico Any images tagged with exclude will not show up below... $thumbnail = $image->width(320); $content .= "<figure class='block thumbnail' itemprop='associatedMedia' itemscope itemtype='http://schema.org/ImageObject'>"; $content .= "<a href='{$image->url}' itemprop='contentUrl' data-size='{$image->width}x{$image->height}'>"; $content .= "<img src='{$thumbnail->url}' itemprop='thumbnail' alt='{$image->description}'>"; $content .= "</a>"; $content .= "<figcaption itemprop='caption description'>{$image->description}</figcaption>"; $content .= "</figure>"; } } Thanks to the ProcessWire Support team. All of you... World class awesomeness.2 points
-
2 points
-
This may get you a bit closer with Phantom.js if you know the coords of your CKEditor field: https://github.com/microweber/screen2 points
-
2 points
-
There is a new development release of Processwire every week that you can download. The upcoming version 3 (currently in alpha) will allow for composer support and lots of other things. Its a good time to get involved. I made the switch about 6 months ago and I haven't looked back. I feel I have only just scratched the surface with what this system could potentially do.2 points
-
Hello guys. As you did notice the search is extremely fast because I'm doing in background a ajex request to the search page when you start typing text in input field. Then all results are cached and displayed when typing. If you have any other question let me know.2 points
-
PageListImageLabel Marty requested and sponsored a new module little while ago. http://processwire.c...t-image-option/ I just wanted to create a separate release thread. Many thanks to Marty for sponsoring and making this possible. This just shows how great this community is. So here it is the Page List Image Label module. It enables you to add thumbnails of images from the pages in the admin page tree. Download: http://modules.processwire.com/modules/page-list-image-label/ Github: https://github.com/somatonic/PageListImageLabel A screenshot of it in production. (old version)1 point
-
Sometimes you have clients who will login to the admin, and they perhaps only need to access a few areas of the site, such as: a product or blog list (ListerPro) site settings formbuilder entries specific front end pages documentation helpdesk backup interface Server health or server status (for example site5 has a page for every server to see it's status) Link to a bookmark (page tree bookmark for example) - this is awesome by the way Run a special action like clear a wirecache or other custom caching Add a billing or late payment notice Add an alert about upcoming server maintenance The Problem: How can you collate all of these diverse links and messages into 1 page, as fast and easy as possible, make it hassle-free to add stuff to it, maybe some messages, change the order of the links etc. In some systems this is called the Dashboard. You can make one in a few minutes using: 1.) Admin Custom Pages 2.) ready.php in your site folder Steps: Install ACP create a file inside templates for your dashboard (e.g. _ac_dashboard.php). Create your dashboard page below the admin branch of the page tree, assign it to ACP, and set the template to use to the one you created. This example will display a table of quicklinks. Contents of the dasboard file: <?php wire('modules')->get('MarkupAdminDataTable'); ?> <h3>Title of site here</h3> <div id='ProcessFieldList'> <table id='AdminDataTable1' class='AdminDataTable AdminDataList AdminDataTableResponsive AdminDataTableSortable'> <thead> <tr> <th>Item</th> <th>Comment</th> </tr> </thead> <tbody> <tr> <td><a href='<?php echo $config->urls->admin?>blog/'>Blog</a></td> <td>Filterable/Searchable listing of blog posts.</td> </tr> <tr> <td><a href='<?php echo $config->urls->admin?>news/'>News</a></td> <td>Filterable/Searchable listing of news items.</td> </tr> <tr> <td><a href='<?php echo $config->urls->admin?>projects/'>Projects</a></td> <td>Filterable/Searchable listing of projects.</td> </tr> <tr> <td><a href='<?php echo $config->urls->admin?>page/'>Page Tree</a></td> <td>A hierarchical listing of the pages in your site.</td> </tr> <tr> <td><a href='<?php echo $config->urls->admin?>settings/'>Site Settings</a></td> <td>Global site settings</td> </tr> </tbody> </table> <script>AdminDataTable.initTable($('#AdminDataTable1'));</script> </div><!--/#ProcessFieldList--> You only need this if you want to redirect logins to the dashboard: add to ready.php (where 1234 is the ID of your dashboard page): if($page->template=="admin" && $page->id == 2) $session->redirect($pages->get(1234)->url);1 point
-
WireMailBranding Add email templates to wireMail From this: $mail->bodyHTML("<h1>Hello</h1><p>I'm WireMailBranding</p>"); To this: (or whatever template you create) How it works? Create an email template without content. On the spot where you wish to have your content place the tag {bodyHTML}.The markup you've set with $mail->bodyHTML('<p>Markup</p>'); will replace that tag. You could set the defaults in the Module configuration or set the properties with the API. (See below) The API will overwrite the default settings $mail = wireMail(); $mail->to('user@some-domain.ext')->from('you@own-domain.ext'); $mail->subject('Mail Subject'); // Set path to template (overwrites default settings) $mail->template('/site/templates/template_wrapper.php'); // Enable/Overwrite the Emogrifier CSS inliner. (0, bodyHTML, wrapper) $mail->inlineCSS('bodyHTML'); $mail->bodyHTML('<p>This paragraph will replace the {bodyHTML} tag in the mail template.</p>'); $mail->send(); CSS inliner We have added the beautiful css inliner Emogrifier to inline the CSS styles. When using the Emogrifier CSS inliner applying it on the bodyHTML only is the most efficient way. We recommend you to write the inline styles for the wrapper manually. The module is sponsored by Calago.nl. Thanks guys ! Updates 0.1.2 Bug fixes : - Fixed redeclare Emogrifier bug. Improvement - Added error logging for Emogrifier - Added inputfield error for the lack of PHP's mbstring in the module configuration. - Some code cleaning and other cosmetics 0.1.3 Bug fixes : - Fixed bug when module couldn't grab bodyHTML (resulted in doing nothing at all). GitHub https://github.com/Da-Fecto/WireMailBranding Modules directory http://modules.processwire.com/modules/wire-mail-branding/1 point
-
That is basically correct, but the timestamp will also be included in the filename of the cropped version. Is it important that the timestamp is updated to match the exact time the image is actually cropped? The "Rename on Save" option might work - haven't tested.1 point
-
Last time I used a "Login via Facebook", my Facebook account was hacked...1 point
-
you could for example create a treenode for all zip-codes with lat and lng values: - zipcodes |- 100 (title = 100, lat = 16..., lng = 48...) |- 101 (title = 101, lat = 15..., lng = 47...) then calculate the distance like showed in my links, but you dont need to query the database when you are using processwire pages. its something like: <?php $zip = ... // center of search $radius = ... // radius to search $results = ... // array to store results foreach($pages->get('/zipcodes')->children as $item) { // calculate distance to requested center $distance = ... // see stackoverflow example if($distance <= $radius) { $results[] = array($item->id, $distance); } } // order $results by distance // render each result sorry, 1 step missing. after you have your zip-codes within your radius you would have to get all pages that match that zip-code. you could use a pagefield in your dealer's page to choose the zip-code (it has to reference the pages under /zipcodes so that you can calculate the distance from lat/lng create a string with your zips inside the radius with php implode to get something like "100|101|104|105" and then use a selector to select all dealer's pages that have one of those zip-codes in its pagefield: https://processwire.com/api/selectors/#or-selectors11 point
-
@ebencosoft Please use the codeblocks when posting code, especially if it's that much code.1 point
-
Bug fix where the module didn't served the wrapper at all. Updated the first post.1 point
-
hi liam, welcome to the forum! you need zip with lat/lng in your database and then you can do something like this: https://www.dougv.com/2009/03/getting-all-zip-codes-in-a-given-radius-from-a-known-point-zip-code-via-php-and-mysql/ http://stackoverflow.com/questions/8549940/zip-code-proximity-calculation-in-php maybe you have to keep an eye on performance depending on your dataset...1 point
-
1 point
-
Just to prevent misunderstandings. You're already using the "correct" InputfieldFile as the FormBuilder custom one is even more specific. Also the add() method didn't fail because of a missing table, but just because of the missing page. The page itself doesn't necessarily need an file field, as Ryan also stated, but mostly it's id is needed to determine the folder to put the files into.1 point
-
I don't think you can achieve this (maybe 5yrs later ). My first (and only) idea is to use html5 canvas but I'm not sure that would work. Here is something similar: http://cburgmer.github.io/rasterizeHTML.js/1 point
-
[[!ProcessWire? &var=`Stable, fast, powerful, consistent and makes you smile.`]] And doesn't use silly snippets1 point
-
Hey Guys, sorry for not responding or being active in any PW related topic for some time now. First of all, yes I closed the shop and shut down my servers. I had some major trouble in the past related to my personal situation which made it impossible to work on my projects or to maintain them. Active development of the office suite would not continue, sorry for that. During the last 12 months I changed my work live completly, I am now hired as Product Manager in a company and dont do freelancing stuff anymore. I would overthink your wish to make the suite OS and share my decision on this the next few days with u if there is still interest in it, just let me know. Luis1 point
-
Hi, and welcome to the forums! The ProcessWire eco-system is active. Ryan Cramer, the creator, is continuously adding new features to PW (on the dev branch) and fixing bugs as he goes along. The community here is small, but active and very helpful. The Modules Directory is also active, with some interesting modules popping up on a regular basis. As mentioned above, PW3 will be Composer-ready, with namespace support. Many here are quite excited about PW3. Version 2.7 is just around the corner (maybe this week), and contains several great updates in comparison to the current 2.6.1 stable. So yes, I recommend the jump.1 point
-
Came across this little survey on https://www.designernews.co/stories/58701-survey-dn-cms-for-clients recently. I have no idea how many readers DN has, but I thought it can't hurt to post something about PW there. Feel free to add to the discussion...1 point
-
If you upload a random txt or html file to your web server, can you access it at the other domain? My guess is yes. If so, it sounds like an honest mistake. Perhaps you are on a dedicated IP and the owner of the other domain made a typo when setting up their DNS record. Or perhaps the web host made an error when setting up their VirtualHost directives in Apache. You should be able to correct the problem by adding this to your .htaccess file somewhere after the "RewriteEngine On" line: RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC] RewriteRule ^ http://www.yourdomain.com/ [L,R=301]1 point
-
I could indeed do that, but I have already implemented a templating system which gives flexibility in terms of defining plain and rich templates. Inlining CSS (as opposed to prepending a stylesheet) is a great thing for email templates, as it ensures client compatiability. So I'd like to include that specific class in SimpleForms. That said, I could look into providing the option of using your module in SimpleForms, provided it is installed. Will look into this soon. (Side note: Development of SimpleForms (and the new Jumplinks) is paused at the moment as I cannot dedicate enough time in my day to working on it. Hope to start again soon - it is still fresh in my mind.)1 point
-
I'll spend a little snippet to render a nice admin table in such kinds of dashboard.... //lets's show some last events //rootpage of articles is XXXX // Find some pages $events = $pages->find("template=event,check_active=0,limit=5,sort=event_start_date,sort=event_start_time"); $table = $modules->get("MarkupAdminDataTable"); $table->headerRow( ["Title", "Created", "User"] ); $table->setSortable(false); $table->action(array( 'New Event' => $config->urls->admin . 'page/add/?parent_id=XXXX', 'All Events' => $config->urls->admin . 'page/events/', )); foreach($events as $page){ $data = array( // Values with a sting key are converter to a link: title => link $page->title => $config->urls->admin."page/edit/?id=".$page->id, date("F j, Y", $page->created), $page->createdUser->full_name ); $table->row($data); } // $table->footerRow( $someArray ); echo '<div class="someclass">'; ">'; echo $table->render(); echo '</div>'; renders something like this: have fun1 point
-
1 point
-
Elastic Search itself was okay. Here's what I found. Timeout while indexing: The module's code for indexing all pages does a find and I'd assumed it would make use of the template whitelist value from module configuration but it didn't. It finds lots of pages, then skips the ones which should not be indexed. I have thousands of simple pages (containers for images) which don't need to be found by this selector. Now I'm using the whitelist to build a more specific selector. May have to break this up into multiple finds when I have more content. In checkForRebuildSearchData() $arr = $this->getAllowedTemplates(); $str = (count($arr)) ? ' template='.implode('|', $arr).',' : ''; $pages = $this->pages->find("id!=2, id!=7, has_parent!=2, has_parent!=7, template!=admin,$str include=all"); The other thing that became obvious pretty quickly is that the Textareas (with an s) fieldtype was not handled. Adding a function and a line to use it in getAllContentForPage() took care of that. protected function getTextareasTypeAsContent($value) { $values = array(); foreach ($value as $name=>$value) { $values[$name] = $value; } return $values; } ... elseif ($type instanceof FieldtypeTextareas) $value = $this->getTextareasTypeAsContent($value); I've confirmed that it is picking up changes when I edit pages. Too early for opinions on effectiveness of Elastic Search itself.1 point
-
What I do is use $config->js to populate the config array that I then output in the head for dynamic variables that want to share in a script. $config->js("myconfig", array("myajaxurl" => $pages->get(1991)->url); You can do this in templates or modules doesn't matter as long as it's before rendering page. Then this little to output as json. This is the same as PW uses in the admin to share config vars with js. <script type="text/javascript"> <?php // output javascript config json string to html // for use in javascripts from this point on $jsConfig = $config->js(); $jsConfig['debug'] = $config->debug; $jsConfig['urls'] = array( 'current_url' => $page->url, 'root' => $config->urls->root, ); ?> var config = <?php echo json_encode($jsConfig); ?>; </script> Then use in your script as var rootUrl = config.urls.root; for example1 point
-
On this page we have allowed the customer to create their own Paypal cart button for a list of products http://www.inspirefit.co.uk/clothing/ Previously, we would use the image resize functions built in to Processwire (you know image->size(200,150) and all that) but to make an image work in Bootstrap 3 we need to allow it to do it's thing - ie remove this sizing statement. Bootstrap then applies its css: width: 100%; height: auto; But... as you see on this page, the client has uploaded massive images and the system has not cached anything. Giving us an undesirable pages of well sized but big image files. Is there a solution to this at all?1 point
-
In your template files, you can always control access just by performing your own checks, and that may be the simplest route here. For instance, you could have something like this at the top of your template file: if(!$page->category->viewable()) $session->redirect('/path/to/login/page/'); Another way to do it is to hook into Page::viewable to perform your own permission checks. The benefit here is that you would keep it all in one place: wire()->addHookAfter('Page::viewable', function($event) { // if it was already determined page is not viewable, then we'll exit and stick with that // this may or may not be the behavior you'd want, but you probably want some "early exit" // thing to check so that you aren't completely disregarding what the existing // $page->viewable() returned if(!$event->return) return; // check that this page has a 'category' field that we are using for permission $page = $event->object; if(!$page->category) return; // we'll abort now if there is no category // if category isn't viewable, we'll say this page isn't viewable either if(!$page->category->viewable()) $event->return = false; // you could also do things like check user roles: // if(!$user->hasRole('some-role')) $event->return = false; });1 point
-
Hello, I'm working on my first project with PW. Working with PW is amazing so far. As I am coming over from the Joomla world I am used to adding scripts to individual pages with a Joomla built in method. Searching for the PW way of doing this, I came along that post where I found this snippet of code: $config->scripts->add($config->urls->templates . "scripts/lightbox.js"); Great, I thought. But using just that snippet wouldn't include the script. I had to add a second snippet foreach($config->scripts as $url) echo "<script type='text/javascript' src='$url'></script>"; (which I also found in that other post) to actually load the script wherever I wanted in my template file. Lets assume you are working with the default PW Profile on a fresh install and want to load the lightbox.js only on the homepage and the template file for your homepage is home.php. Then you would include the first snippet in your home.php. The second snippet goes either in your head.inc into the head section or in your foot.inc at the bottom (whereever you prefer to load your js). This is a quite generic way to include scripts. If you wanted to have another script loaded only, lets say, on a contact page with template file contact.php the you just need to add a snippet, e.g. $config->scripts->add($config->urls->templates . "scripts/contact.js"); to contact.php. The second snippet foreach($config->scripts as $url) echo "<script type='text/javascript' src='$url'></script>"; already sits in your head.inc or foot.inc where you put it before and it will take care of including also contact.js because of the foreach loop. I guess that most of you already know this. But for a newbie like me I had to write this down to properly digest it and maybe it is helpful to someone else. Cheers gerhard1 point
-
I like Dragan's approach if you don't mind mixing JS into the CMS side of things. Whether that's a good practice or not really depends on who's going to be using the admin. If you want to keep this on the development side rather than the content side, one approach I've used is to keep JS files named with the ID of the page. When a JS file existed that matched the ID of the page, it would be included in the <head> section. Example: <?php $file = "scripts/$page->id.js"; if(is_file($config->paths->templates . $file)) { echo "<script src='{$config->urls->templates}$file'></script>"; } More often, I use this approach with the template file, i.e. have a file named basic-page.js that gets included on any pages using the basic-page template.1 point
-
Just hitted this myself. Should all languages be active from API by default? That would be in line with how it functions in admin.1 point
-
Assuming I understand the need correctly, what I usually do add this to the <head> section of the main markup include: <head> <!-- all your typical <head> stuff --> <?php $file = "styles/$page->template.css"; if(is_file($config->paths->templates . $file)) { echo "<link rel='stylesheet' type='text/css' href='{$config->urls->templates}$file' />"; } $file = "scripts/$page->template.js"; if(is_file($config->paths->templates . $file)) { echo "<script src='{$config->urls->templates}$file'></script>"; } ?> </head> Using this method, if you have a template named 'product', then it could have dedicated CSS and JS files in /site/templates/styles/product.css and /site/templates/scripts/product.js, when you need it. The nice thing about this is that it's just a system rather than hard coded file. If you determine you need something unique for the CSS (or JS) on pages using some template, the you can just create the CSS (or JS) file and have it start working automatically. You can take this further too. For instance, you could use the same technique with page IDs to assign custom CSS/JS files to specific pages.1 point
-
Sneak Preview (everything configurable, styling mostly controlled by admin theme):1 point