Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/09/2012 in all areas

  1. I wanted to give you a little preview of a new module I've been working on recently: the Form Builder module. This module lets you create simple-to-complex forms and place them in your site without any need for development. In this video we show how we can create, publish and test a simple contact form in less than 5 minutes. Then we take a quick look at a more complex form (already produced). I recommend viewing the full screen + HD 720p version so that you can see it more clearly than in this small forum embed. (note: there's no sound, so no need to adjust your volume) More about the Form Builder The Form Builder has many options for the developer to customize output and create their own themes, markup, etc. But the goal here was to build something that could enable you (or your client) to publish a form in less than 5 minutes, so that's the focus of this video. This tool is literally easy enough for your clients to create and manage their own forms. Or from a developers perspective, it takes something that used to consume hours and makes it happen in minutes. Form results save in the database and optionally can be CC'd to you by email. Result entries and be viewed, filtered by date, and even edited in the admin. You can export results to a spreadsheet as well. I'm working on the ability to export to pages, though that isn't quite ready yet. How the Form Builder will be licensed This module will be individually licensed on a per-site basis for a small license fee. It will also be available for free personal use to established forum members. Basically, I want to see if I can substitute some of my client work to focus on ProcessWire instead. And in order to do that, I need to have an income (I have a family to support). So I thought that building a special tool like this would be a way to make a go of it. A lot of you have asked to make donations to the ProcessWire project, and while we still won't be able to take donations, you will be able to support the ProcessWire project by purchasing and using the Form Builder in your own client projects. So a lot of motivation for this module came from wanting to provide something really special for all that had wanted to support ProcessWire. After a few months of work, I'm pretty happy with how this module has turned out -- it's already saved me tons of time in my client projects. So I'm thinking and hoping you guys will really like it too. I look forward to your feedback.
    1 point
  2. Hi! Just finished my first module This module adds a new "Google-Analytics" Page in your Admin-Panel and displays various Statistics from a Google Analytics Account. It uses the JQuery plugin "jqplot" to display the charts. Github: https://github.com/w...GoogleAnalytics Modules directory: http://modules.proce...ogle-analytics/ Features Visits by Date (Chart) General Statistics about Visits (Total visits, Visit duration, New visitors, Returning visitors etc.) Demographics: Countries, Cities, Languages System: Browsers, Operating Systems, Screen Resolutions Mobile: Operating Systems, Screen Resolutions Pageviews by Date (Chart) Top Content Traffic Sources: Keywords, Referral Traffic by Domain and URI Choose a default date range displaying statistics: last 24 hours, 2 days, 1 week, 1 month etc. Custom date range by setting a "start date" and "end date" Requirements Google Account and Analytics Account A Project in the Google APIs Console cURL Installation 1) Create a Project in the Google APIs Console: Create a new Project in the APIs Console: code.google.com/apis/console/ Under Services, enable the Analytics API Under API Access: create an Oauth 2.0 Client-ID Give a Product Name, choose "Web-Application", Domain doesn't matter Enter a Redirect URI to the GA-Page in your Processwire Installation: http://yourdomain.com/processwire/google-analytics/ Notes: The redirect URI must exactly match with the URL from the new "Google Analytics" page in Processwire. Open the Page and copy the URL from the address-bar (localhost does work too!) The project created in the APIs Console can be reused for every Processwire installation using this module. You just have to enter more redirect URIs 2) Install the module: Place the module's files in /site/modules/ProcessGoogleAnalytics Install the Module via the Admin-Panel Enter Client-ID and Client-Secret keys from the created project in the module config Load the newly created page "Google-Analytics" and click on the button "authenticate" Grant the module access to the Analytics Data Choose a Google Analytics account (Domain) from the dropdown Done: You should see the statistics. Check out the module config options for further customization In order to let other users see the Google Analytics page, you must give their role access to the "ga-view" permission. Ps. Processwire is awesome and so is this community!
    1 point
  3. I figured it out! I noticed the AJAX queries to grab the data are including the API Developer key in the URL. However, according to Google (https://developers.g...rence#q_summary) it says that the parameter is optional and that you should do that when authenticating with OAuth 1.0. Since the module uses OAuth 2.0 for authentication, that query parameter should be left out. I commented out this line in the module (line 930 under the _loadGoogleApi function): $this->ga_client->setDeveloperKey($this->developerKey); That seems to have done the trick! It's loading the data beautifully! (And it also allows me to select the domain in the drop down correctly too.)
    1 point
  4. Hello there, First of all, letting a client post HTML straight into a field and then echoing it (especially without escaping anything) could potentially break things up and cause quite a bit of confusion / extra work for you, so I wouldn't really suggest it. IMHO better option would be to ask the client to post WordPress embed tag offered by SoundCloud to the body field (or any other field you've specified, actually) and then replace that with actually player code at your template. WordPress embed tags look like this: [soundcloud url="http://api.soundcloud.com/tracks/59233018" iframe="true" /] Simply ask your client to post these tags to whatever field you've specified, each as it's own paragraph (just paste and hit enter when field has TinyMCE enabled.) Then include this code in your template (I'm using body field as an example here): <?php $replacement = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F$1&show_artwork=true"></iframe>'; $page->body = preg_replace("#<p>[^\w]*\[soundcloud url=\"http:\/\/api.soundcloud.com\/tracks\/([0-9]+)?\"[\w\=\" ]* \/\]</p>#i", $replacement, $page->body); That should do the trick. EDIT: once again I've been too slow.. damnit. Oh well, now there's twice the regexp fun to check out. EDIT 2: @danielholanda, even though both answers so far have certain similarities (regexp ftw), there's actually one important difference just in case you've missed it: the method diogo provided is based on adding a specific field for songs. This way if you want multiple songs on one page you could add that field inside a repeater and loop through it's content. The method I posted above is based on the assumption that you could be using that same field for both "typical" content and (multiple) SoundCloud embeds. I'm adding this just to clarify both methods a bit and make it easier to choose which method you're going to use. This really depends on how your client will manage this content too; especially if each SoundCloud clip has it's own page there's very little point for using the latter method.
    1 point
  5. I had a look at soundcloud sharing options, and they don't look very smart... Still, I think your best option would be using the wordpress option that looks like this: [soundcloud url=http://api.soundclou...racks/59046167" iframe="true" /] You have two options. One that represents more work to the editor but less processing work, one simpler to the editor but more complex in PHP. For both options, create a text field "song", and add it to the template. For the first option, teach the editor to get the wordpress sharing option in soundcloud, extract the number of the song [soundcloud url=http://api.soundcloud.com/tracks/59046167" iframe="true" /] and put it on the "song" field. The code on the template would be this: $song = $page->song; echo "<iframe width='100% height='166' scrolling='no' frameborder='no' src='http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F{$song}}&show_artwork=true'></iframe>"; Second option, is a little bit easier to the editor because he doesn't have to look for the number on the wordpress code. Only copying it. [soundcloud url= iframe="true" /] Your code would have to be more complex, and a bit slower in terms of processing: $src = $page->song; preg_match( '/([0-9]+)/', $src, $matches); //extracting the numbers part of the url with a regular expression $song = $matches[1]; // and putting it on a variable echo "<iframe width='100%' height='166' scrolling='no' frameborder='no' src='http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F{$song}&show_artwork=true'></iframe>"; edit: corrected some typos by WinnieB's suggestion
    1 point
  6. SessionLogginthrottle.module counts the amounts of invalid login. & set the time when tried to login. If you you have a valid login, i think( not shure) that the login counter should be reset to 1. So nextime you login in wrong again you dont have to wait, 90 or 120 or 300 seconds for example.
    1 point
  7. Strange, I replied to this yesterday and now don't see my message. I'm wondering if I forgot to hit post or something (or maybe I'm losing it?) Anyway I fixed this yesterday morning so searching for CSV should now work. I switched it to use '%' and added the summary, description, class_name and instructions fields to the search.
    1 point
  8. After Ryan's latest incarnation of Blog Profile I wanted to see if I could learn something from there to my own workflow. It turned out very nicely and this seems like a perfect template approach for me. Wanted to share it with you guys. Folder structure under templates folder: templates/markup/ templates/markup/helpers/ templates/markup/layouts/ templates/scripts/ templates/styles/ And it all begins from here: templates/markup/index.php -this is the "complete" html file, it has doctype, head and starting and ending body. There is very little "logic" here, it's more like a container. There is one very important code snippet there though: <?php if ($page->layout) { include("./markup/layouts/{$page->layout}.php"); } else { include("./markup/layouts/default.php"); } ?> Code above goes between header and footer of your site, that will be the main content. I call it layout, but the better name would be "content layout" or "inner layout" or something like that. Then the templates/markup/layouts/ folder will keep at least default.php file, but probably few others, like "threeColumns.php", "frontpage.php", "gallery.php" etc.. you got the idea. Each of the actual pw template files are then purely "controllers" - no actual markup generated there. All markup are done in files inside templates/markup/ folder and it's subfolders. This is how template file templates/home.php on one site I am building right now looks like: <?php // Carousel items $t = new TemplateFile(wire('config')->paths->templates . 'markup/helpers/carousel.php'); $t->set('carouselPages', $page->carousel); $page->masthead = $t->render(); // Tour themes $t = new TemplateFile(wire('config')->paths->templates . 'markup/helpers/items.php'); $t->set('title', "Get inspired from our <strong>tour themes</strong>"); $t->set('items', $page->featured_themes); $t->set('description', $page->themes_description); $t->set('url', $config->urls->root . "themes/"); $t->set('linkTitle', "All themes"); $page->main .= $t->render(); // National parks $t = new TemplateFile(wire('config')->paths->templates . 'markup/helpers/items.php'); $t->set('title', "Seven beautiful <strong>national parks</strong>"); $t->set('items', $page->featured_parks); $t->set('description', $page->parks_description); $t->set('url', $config->urls->root . "national-parks/"); $t->set('linkTitle', "All national parks"); $page->main .= $t->render(); $page->layout = "frontpage"; include("./markup/index.php"); This uses few "helper" markup files from templates/markup/helpers/ folder (namely carousel.php and items.php). Here is the carousel.php for your reference: <?php /* Generates the markup for the frontpage carousel */ if (count($carouselPages) < 1) return; $styles = ''; echo "<div id='carousel'><ul class='rslides'>"; foreach($carouselPages as $key => $p) { echo "<li class='c-item c-item-$key'>"; echo "<img src='".$p->image->getThumb('carousel') ."' alt='' />"; echo "<p>$p->summary</p>"; echo "<a class='button' href='{$p->link->url}'>$p->headline</a>"; echo "</li>"; } echo "</ul></div>"; Then populates the $page->masthead and $page->main properties and then set's the inner layout to "frontpage". That templates/markup/layouts/frontpage.php file is very simple on this site, but could be much more complicated if needed: <div id="masthead"> <?= $page->masthead; ?> </div> <div id="main" class="wrap"> <?= $page->main; ?> </div> Frontpage is rather unique and I could have done all the markup on the frontpage.php file also. But I do want to re-use those "carousel" and "items" components on other places as well. But if I do have totally unique stuff, where I do want to get "quick and dirty" this approach allows it. Then my template file would be something like this: $page->layout = "campaign2012"; include("./markup/index.php"); And then all the markup would be in that templates/markup/layouts/campaign2012.php Blog profile really gave me a good ideas (cleaner folder structure etc) and using TemplateFile class adds nice possibilities. This is of course just a one way to manage your templates, but hopefully someone of you finds this helpful when thinking about how you like to structure this stuff. PS: If you are just getting started with PW, then I recommend using the head and foot includes method from demo install. There is nothing wrong with that method and only more complicated sites starts to benefit from these methods introduces in this topic.
    1 point
×
×
  • Create New...