Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/16/2015 in all areas

  1. I mostly just need a grid and a solid typography solution.
    6 points
  2. SimpleForms Alpha bumped to 0.8.0, featuring support for YAML configuration (proudly powered by symfony/yaml), in addition to JSON. You can now use a config.yaml file instead of config.json. Note that that JSON is preferred over YAML in the case that both files exist. An example YAML config file is in the default-forms directory. As you just noticed, the form directory is no longer named "forms" - it is now named "default-forms". When you install the module, the contents of this directory is copied to site/assets/forms. To me, this seems to be best-practice, considering the fact that the previous directory was wiped out on module upgrade. Lastly, you may find that, in some situations, selected fields need to be disabled when the form is rendered. For example, a "subject" field may need to be pre-populated based on a GET parameter and, therefor, read only. Often, the readonly attribute is enough, but I think disabled is better. Previously, such a field would be re-enabled after the form was processed and validation errors occurred (you may have noticed that the entire form is disabled when the form is processing). Now, these state of these fields persist by adding data-sf-disabled when the form is prepared by the front-end plugin. This makes the behaviour consistent with the intention.
    5 points
  3. You can use Hanna code for this http://modules.processwire.com/modules/process-hanna-code/ You would create a new Hanna code called, let's say "value", and put something like this in the code: echo $page->get($field); Then you would simply do this inside the body text: [[value, field=parent_company]] Read the Hanna code instructions to have a feeling of what you can do with it.
    5 points
  4. In my _main.php files I typically include a "layout" variation file. This is what you would start with as the main template, but moved outside to allow more customisation and flexibility. Specify a default layout to use in the _init.php file, and overwrite it in your template files as and when necessary. _main.php <html> <head> <style></style> ... </head> <body> <header class="header">...</header> <section class="main"><?php require "./includes/layouts/{$layout}.php"; ?></section> <footer class="footer">...</div> </body> </html> _init.php $layout = 'default'; // specify a layout that would be used for "most" pages (I call mine default) So most sites might have default, home and contact layout varieties as a starting point. A layout would include the stuff that varies between page designs and you would create as few or as many as you need, and call on the variables set by the template. For example, layouts/contact.php: <section class="content"> <p>This is our address</p> <?= $page->body ?> </section> <aside> <iframe class="map">...</iframe> </aside>
    4 points
  5. Hi all, I thought I'd take this opportunity to announce a module I've been working on for a private project. Although it's not yet complete, I thought I'd take the time out to see if anyone would be interested in it. I only have the module locally on a test site, so if there is any interest, I can upload it somewhere suitable and maybe others can add to it, provide feedback etc. What is HermodBB? Hermod (messenger of the Norse gods) BB (Bulletin Board) is a module that installs a selection of templates and fields that you'd expect for a frontend forum. It also provides some methods to easily save topics and comments. All topics and comments (replies) are simply pages, and are organised like can be seen in the following image. Each forum has checkbox permissions for viewing, posting, pinning etc (see image below). These permissions can then be verified with some simple code (see below). // Use the helper method to pull a list of forum pages $forums = $hbb->forumsRender(); foreach ($forums as $forum) { // Only show the forums to those that are allowed to view them $rolesForumView = $forum->hbb_forum_view; if ($rolesForumView->has('id=' . $user->roles)) { // User has view access for the forum } } HermodBB also makes it easy to add comments to other pages, i.e articles, blogs etc. Comments are added as sub-pages, just like they are for topics. What HermodBB doesn't do HermodBB does not dictate any markup or sanitization. Any sanitization method can be used, and each topic and comment can easily be rendered as required. I'm currently using UIkit and CKEditor, but this can easily be changed to Bootstrap/Foundation etc. It keeps everything simple so that Processwire can do all the heavy lifting. Note: I am aware that there is the excellent comments module by Ryan, and also the Discussions module by Apeisa, but I needed something a little different for my current project, so I decided to have a bash myself. I am by no means on the same level of coding as the majority of members on here, so please be gentle I'd also like to thank Ryan personally for such an excellent framework. Any questions etc, please feel free to ask.
    3 points
  6. Damn, I like germans! CTRL is STRG on German keyboards, but still CTRL on Russian ones. Got some national pride! But if we didn't lose that cold war it could look like this...
    2 points
  7. Check this out. Is that what you looking for? What is STRG by the way?
    2 points
  8. Just as a follow-up : I've noticed this happened just because of my 'Alt-Gr' keyboard latency. I explain : when I type ' || ' on my keyboard, I need the 'Alt-Gr' key and the second space character is then often hit with 'Alt-Gr' down making it a non-breaking space And VIM didn't show any difference. (but PHP did!) To finish : here's what I found that helped (in case it helps others) : https://wincent.com/blog/making-vim-highlight-suspicious-characters
    2 points
  9. If there is a need to have more than one _main.php I just create another one. Ex _main.php, _main_admin.php, _main_user.php _init.php $fileToRender = '_main_user'; config.php $config->prependedFile = '_init.php'; $config->appendedFile = '_main.php'; home.php (example template) if($user->isSuperuser()) { $fileToRender = '_main_admin'; } _main.php require_once '_header.php'; echo wireRenderFile($fileToRender); require_once '_footer.php';
    2 points
  10. Hi Roych and welcome to the forum! There is Damienov's function for rendering a bootstrap 3 dropdown menu. So no need to reinvent the wheel You need to include that function somewhere in your template. E.g. you could make a file functions.php and put that function inside and save it to site/templates/inc/functions.php. Note that this part does NOT belong in your functions.php, only the function itself: // bundle up the first level pages and prepend the root home page $homepage = $pages->get(1); $pa = $homepage->children; $pa = $pa->prepend($homepage); // Set the ball rolling... echo renderChildrenOf($pa); Then in your main template or even in your init.php file you include the function: /* * Include any other shared functions we want to utilize in all our templates * */ require_once("./inc/functions.php"); Now in your template were you want to render the function you put this part: // bundle up the first level pages and prepend the root home page $homepage = $pages->get(1); $pa = $homepage->children; $pa = $pa->prepend($homepage); // Set the ball rolling... echo renderChildrenOf($pa); This should render a nice BS dropdown navigation.
    2 points
  11. Good to hear celfred. We should pin messages like these on the door
    2 points
  12. Results for the YAML poll indicate that the most preference is given to its implementation in addition to JSON (with six votes of the ten votes already cast). Will get cracking on this now. It'll work by auto-detecting what is in use, and will give preference to JSON, if both formats are provided for a form. That poll is now closed. Shortly after, will get to work on multi-language support for validation and other messages. Then, I'll begin work on the renderer, which may take a while (guess I need to do a bit of research). Anyone with ideas on how to go about it and/or what the config structure should be is more than welcome to contribute them.
    1 point
  13. nobody said it can't be used for the whole template hmm... nice. you could also handle everything in your template and outsource your markup to a different file: yourtemplatefile.php <?php $config->session->myvar = 'test1'; // set session variable manually for testing $cache = $modules->get("MarkupCache"); $cache_key = 'page_'.$page->id.'_myvar_'.$config->session->myvar; if (!$output = $cache->get($cache_key)){ $output = wireRenderFile('_markup.php'); $cache->save($output); } echo $output; _markup.php <html> [...] <?= $page->title ?><br> <br> <?= $config->session->myvar ?> [...] </html> so all your templates that are using "yourtemplatefile.php" will have cached output based on your session key. don't know how this compares to templatecache regarding performance but would be interesting to know
    1 point
  14. BernhardB, thanks for response! A very nice module, I've found it very useful! Thanks for advice! But I needed to make cache not for a part of the template, but whole template. (have some specific ) So I came up with the solution, using this module: (maybe someone will find it useful too) <? $cache = $modules->get("MarkupCache"); $cache_key = 'page_'.$page->id.'_myvar_'.$my_session_var; if (!isset($options['render_for_cache'])){ $page->template->prependFile = ''; if (!$output = $cache->get($cache_key)){ $output = $page->render(array('render_for_cache' => 1, 'prependFile' => '', 'appendFile' => '')); $cache->save($output); } echo $output; } else{ ?> <!-- here is my plain html/php markup --> <? } ?> So now I can make a cache for any template with any cache_key. I'm sure it's possible to make a Hook using "before render" for certain templates, so that can make cache and keep the template file clean. (or maybe not ) Anyway don't want to do it, ask me if someone need it
    1 point
  15. It handles all the sysadmin stuff. You want another application/website? Login > Create new user > Create new application > Enter name > Save > Done. No other steps really. Works like a charm and very responsive support too (even in Amsterdam timezone).
    1 point
  16. hi mav_medved, welcome to the forum! sounds like markupcache is the right thing for you: https://processwire.com/talk/topic/7-new-markupcache-module/ http://modules.processwire.com/modules/markup-cache/ you could just create a cache-file bound to your session variable $cache = $modules->get("MarkupCache"); if(!$data = $cache->get($your_session_var)) { $data = [...] // your code $cache->save($data); } echo $data; don't know if or what procache has to offer in this case... hope that helps
    1 point
  17. I'm attending the warm-up as well - yeah, wireshell meeting approaching!
    1 point
  18. Is there any way I can send you money? (On some occasions I believe I have threatened to send money to someone brave enough to take a stab at creating a PW-based forum solution)
    1 point
  19. Also, there are some basic module settings that can also easily be used if required. The image only shows a few options. There are also options to easily set how many topics / comments to display per page for pagination etc.
    1 point
  20. If after the creation of the template you weren't redirected to the templates list, and on the contrary were still on the created template's page, like it happens after the creation of a field, it would be perfect for you . I guess there is a way to add a hook or something similar to change this "action"/"behaviour".
    1 point
  21. Create another template to those pages and edit the template. Then go to the Files tab and specify another file in the "Append file" section. Plus you may need to tick the checkbox to disable automatic appending of _main.php.
    1 point
  22. http://www.korn19.ch/coding/wordpress_logins.php
    1 point
  23. This seriously made me think of creating a minimal template to wp-* URLs saying "This page was intentionally made without WordPress."
    1 point
  24. Hi @Gazley, There is no denying, Semantic UI is very beautiful. However UI Kit has a few more modules that lets me get work out of the door quicker (and make a bigger profit). Here are a few things that I really really like about UI Kit and some things that I don't. Grid 1. data-uk-grid-margin This will add a top margin based on the grid margin when the column is collapsed. This means on mobile no elements are sitting right on top of each other. Instead they have a nice margin between each section. 2. data-uk-grid-match Great for having columns in which you want equal heights, you can do some pretty nice visual designs with this. Such as 50%/50% full width layouts. Components 1. Parallax Like most things with UI Kit it's completely modular and I only include elements I want to use, this makes it super easy. Parallax is one of those elements, it means I can easily add in Parallax elements and still keep it all in the UI Kit Framework. Other useful components include... 2. Dynamic Grid Much like Isotope js, this allows you to create dynamic filterable grids. 3. Sliders There is many options here, there is Slider which allows for mouse scroll and is great for mobile. Slideset which is filterable, great for showing things like clients and Slideshow which is just your usual slider. This comes with plenty of animations, which is all also modular. Core 1. Flex components While not completely supported by older browsers, this gives great control over positioning of content, such as centering content in a div. Combine this with data-uk-grid-match and .uk-flex-middle, you can create absolutely beautiful looking sites. 2. Text Columns Responsive text columns are great, while they are relatively new in not widely supported in browsers, it's great you have that option for modern browsers. 3. Scrollspy Great for the elements that animate on scroll, you can add any class to this also (or even use the javascript event) to have full controls. Javascript Events You can easily hook into Ui Kits javascript events to add custom javascript when certain things happen when using the modules. I know most frameworks have this, but it's a nice things to have. Here is a CodePen showing off a few things that I mentioned (I've tried to put in as many as possible): http://codepen.io/anon/pen/dYVRgQ --- The Bad So here is the bad, not all the components are well polished and require little fixed. For example sliders (used in my example), I much prefer showing them 1 by 1 as it's nice for iPhone uses to use touch controls. However, if there is less than 4 elements, there is sometimes a white flicker on the previous slide as you slide through. It's subtle but it happens. I get around this by making the background black to the slider. It isn't a fix but it makes it less noticeable. The sticky menu doesn't play nicely with the offCanvas and will sometimes stick, I use CSS to get around this applying left: auto !important. Resizing the screen while offCanvas is open will not recalculate the width, breaking the responsive. I got around this by applying width: 100% !important; to the offCanvas overlay. One more thing is that it doesn't apply box-sizing: border-box globally by default, while this isn't much of a problem and more of a personal preference. Overall, these problems are being ironed out and github is getting more active. I do wish for the github community to grow as there are plenty of talented coders out there and UI Kit for me is a great framework which comes with many useful features and most importantly is modular to keep sites lightweight.
    1 point
  25. @arjen : Your code works fine. Thanks! I like the syntax very much and try and use it in the future. My entire code would be a little long to put here, I think and I'm not sure it would help. I can't imagine a ';' or a '}' is missing because everything worked fine before. My previous line was : $class = $page->name == "blog" ? "on" : ""; And i just tried : $class = $page->name == "blog" || $page->name == 'documentation' ? "on" : ""; and $class = ($page->name == "blog" || $page->name == 'documentation') ? "on" : ""; And in both cases I had the error. Then, I tried the longer version I mentionned a tfirst, and still the error occured. And I had to face the same issue (twice actually) a couple of days ago in another part of my code. I eventually found the workaround of copying the || from another place where it works, and as I said, just this manipulation of copying and pasting ' || ' makes the code work as expected. Which is why I wondered if there could have been an issue of character encoding that I would be absolutely unaware of, and this is why I decided on posting here And I'm again glad I did since you're teaching me a nice concise syntax that I should use (and that avoids my problem). So thanks a lot! But if you insist on seeing my code to try and understand the issue, I'll do it. If you have other ideas of where I should look from the info I've just added, tell me. I'd be happy to really understand this problem. @Fokke : Thanks for your quick comment (hence my editing of this post ) : I'm using VIM to code. And guess what : I've just tested your idea : getting rid of my spaces and re-typing them and....... YES! It works ! That's so cool! Now I'll try and understand why is my VIM acting this way and find a solution, but that's another matter. Anyway, a big THANKS to both of you ! This place is really one of the best place on the Internet, and I mean it. I have learned so much here and the community is so 'responsive' when you need help. That's really cool
    1 point
  26. Hi Celfred! Maybe you're having non-breaking spaces in your if statement, which causes the error. Try clearing spaces in your statement and rewrite them. At least on mac version of Sublime Text alt+space inserts non-breaking spaces. If you're using Sublime Text, add this line to key bindings configuration (Settings > Key bindings - User) to prevent those nasty spaces: { "keys": ["alt+space"], "command": "insert", "args": {"characters": " "}},
    1 point
  27. Can you post the full example of the code? The error could be from code above the snippet you posted - i.e. a missing semicolon -;- or closing bracket -}- or something. Alternatively you could try: $class = $page->is("name=blog|documentation") ? "on" : "";
    1 point
  28. Try googling using the words "Expandable Search Codepen". There's tons of examples out there and you can pick out the one that has the characteristics you're looking for. Good hunting!
    1 point
  29. Updated module today to 1.0.3 with a small fix - where the markup would break if there's not encoded single quotes in title or texts for linkedin and twitter. It's now using htmlspecialchars_decode() and rawurlencode().
    1 point
  30. Git is a version control system and not a backup system. It's meant to handle source code and not user content. There are dozens of better ways to backup a whole site.
    1 point
  31. Thanks from me as well. These lines in my template file plus adding alt to the img tags in the theme made my good friend the W3C validator happy. $options = array('title' => str_replace(' ', '%20', html_entity_decode($page->headline))); $soc = str_replace('&', '&', $modules->MarkupSocialShareButtons->render($options));
    1 point
  32. Here's a script that I've been using on our sites and recently enhanced to also handle the conversion from TinyMCE to CKEditor in ProcessWire 2.5. It's a sort of "global config" for CKEditor, which allows you to change the settings for all CKEditor fields at once. Note: This one will automatically update all CKEditor fields unless they are explicitly excluded in the config ($excludedFields). If you want it to change TinyMCE fields into CKEditor fields, make sure $replaceTinyMCE is set to true in the config section of the code. <?php include('./index.php'); // Config $excludedFields = ""; // List of fields to exclude, separated by pipe (i.e. "body|sidebar") $replaceTinyMCE = false; // true|false If true, converts any fields using TinyMCE to use CKEditor instead // Change any fields using TinyMCE to use CKEditor instead if($replaceTinyMCE) { foreach(wire("fields") as $field) { if($field->type == 'FieldtypeTextarea' && $field->inputfieldClass == 'InputfieldTinyMCE') { $field->inputfieldClass = 'InputfieldCKEditor'; $field->save(); } } } // Get all fields using CKEditor $fields = new WireArray(); foreach(wire("fields") as $field) { if($field->type == 'FieldtypeTextarea' && $field->inputfieldClass == 'InputfieldCKEditor') { $fields->append($field); } } // Exclude any fields specified above $fields = $fields->find("name!=$excludedFields"); // Apply settings foreach($fields as $field) { $field->contentType = "1"; // 0="Unknown", 1="Markup/HTML" $field->rows = "15"; // The number of rows initially shown for this field. $field->toolbar = " Styles Undo, Redo Bold, Italic, -, RemoveFormat NumberedList, BulletedList, -, Blockquote PWLink, Unlink, Anchor PWImage, Table, HorizontalRule, SpecialChar PasteText, PasteFromWord Scayt, -, Sourcedialog "; $field->inlineMode = "0"; // 0="Regular Editor", 1="Inline Editor" $field->textformatters = array("TextformatterHannaCode","TextformatterVideoEmbed","TextformatterSmartypants"); // Accepts ordered array of module names $field->useACF = "1"; // 0="No", 1="Yes" $field->usePurifier = "1"; // 0="No", 1="Yes" $field->extraAllowedContent = ""; $field->formatTags = "p;h2;h3;h4;h5;h6"; $field->contentsCss = ""; // Path to your css file, i.e. "/site/templates/styles/contents.css" $field->stylesSet = ""; // Path to js file containing stylesSet, i.e. "mystyles:/site/modules/InputfieldCKEditor/mystyles.js" $field->customOptions = ""; // Custom Config Options $field->extraPlugins = "pwimage,pwlink,sourcedialog"; $field->plugin_sourcedialog = ""; // Sourcedialog settings $field->removePlugins = "image"; $field->save(); } ?> CKEditor is now updated. Updated fields: <? foreach($fields as $field) echo $field.', ' ?> To use the script, simply copy the above code into a file in the root directory of your ProcessWire installation, and name it something like "ckupdater.php". Edit the configuration settings under the "Apply settings" section how you'd like, (I've done my best to briefly document how these work--at least the more confusing ones). To run the updater, just go to www.yoursitegoeshere.com/ckupdater.php. It will confirm the update and tell you which fields were effected. Hope this helps someone out!
    1 point
  33. Hanacode is cool, I used it in combination of tags. (image tags) [[images tags="cars bikes boats"]] Now you could render albums instead of images when there are more then 6 photo's groups or something. There are two annoying things about HannaCode 01. after save it returns to the list of hana codes. 02. I can't use tabs. --- ps, Maybe we need a repository of good Hanna Codes.
    1 point
×
×
  • Create New...