Jump to content

ukyo

Members
  • Posts

    250
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by ukyo

  1. I, bored to write HTML elements inside my PHP code and i wrote a function for use less HTML elements. I think this function also could be helpful for you and maybe we can extend this function for use with all field types. For the moment the function only supporting fields like text, textarea or like these fields. What is this function making ? - Simply this function helping you to write less HTML elements in your PHP code. For the moment its only a function maybe i can make it a module. If you interest, here is gist link : https://gist.github.com/trk/b365f47793927006b1fb Module Usage (Available configs): <?php // Available configs $AvbMarkupOutputConfigs = array( 'tag' => 'div', // Usage for self closed tag : 'hr:/', 'i:/' 'attributes' => array( 'class' => 'element-class', // output : class='element-class' 'id' => 'element-id' // output : id='element-id' // Attributes ), 'data-attributes' => array( 'lat' => 'a-data-attribute' // output: data-lat='a-data-attribute' // Data Attributes : enter like normal attributes output will be data-your-attribute ), 'prepend' => array( // You can use here like main ), 'prepends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), 'field' => 'title', // a field name from your page 'value' => 'a custom value', 'loop' => array( 'tag' => 'div', // Usage for self closed tag : 'hr:/', 'i:/' 'attributes' => array( 'class' => 'element-class', // output : class='element-class' 'id' => 'element-id' // output : id='element-id' // Attributes ), 'data-attributes' => array( 'lat' => 'a-data-attribute' // output: data-lat='a-data-attribute' // Data Attributes : enter like normal attributes output will be data-your-attribute ), 'prepend' => array( // You can use here like main ), 'prepends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), 'fields' => array( 'title', 'body' // Field names from your page ), 'values' => array( 'Custom Value 1', 'Custom Value 2', 'Custom Value 3' // You can use custom values for here ), 'append' => array( // You can use here like main ), 'appends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ) ), 'child' => array( // You can use here like main ), 'children' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), 'append' => array( // You can use here like main ), 'appends' => array( array( // You can use here like main ), array( // You can use here like main ) // ..... ), ); AvbMarkupOutput($AvbMarkupOutputConfigs, $page) ?> Here are some examples about usage, i will make a before this function and after this function : Before : <?php $additionals = "foo bar some custom data"; echo "\n<article class='uk-article'> \n\t<h1 class='uk-article-title'>{$page->title}</h1> \n\t<hr class='uk-article-divider' /> \n\t{$page->body} \n\t{$additionals} \n</article>"; ?> After : <?php $additionals = "foo bar some custom data"; echo AvbMarkupOutput(array( 'tag' => 'article', 'attributes' => array( 'class' => 'uk-article' ), 'children' => array( array( 'tag' => 'h1', 'attributes' => array( 'class' => 'uk-article-title' ), 'field' => 'title', 'append' => array( 'tag' => 'hr:/', 'attributes' => array( 'class' => 'uk-article-divider' ) ) ), array( 'field' => 'body' ), array( 'value' => $additionals ) ) )); ?> Dive deep : <?php echo AvbMarkupOutput(array( 'tag' => 'div', 'attributes' => array( 'class' => 'uk-container uk-container-center' ), 'child' => array( 'tag' => 'section', 'attributes' => array( 'class' => 'page' ), 'child' => array( 'tag' => 'article', 'attributes' => array( 'class' => 'uk-article' ), 'children' => array( array( 'tag' => 'h1', 'attributes' => array( 'class' => 'uk-article-title' ), 'field' => 'title', 'append' => array( 'tag' => 'hr:/', 'attributes' => array( 'class' => 'uk-article-divider' ) ) ), array( 'field' => 'body' ) ) ) ) )); ?> <!-- Output --> <div class='uk-container uk-container-center'> <section class='page'> <article class='uk-article'> <h1 class='uk-article-title'><?=$page->title;?></h1> <hr class='uk-article-divider'/> <?=$page->body?> </article> </section> </div> <?php // Create a table same like this :: http://getuikit.com/docs/table.html#usage echo AvbMarkupOutput(array( 'tag' => 'table', 'attributes' => array( 'class' => 'uk-table' ), 'children' => array( array( 'tag' => 'caption', 'value' => 'Table caption' ), array( 'tag' => 'thead', 'child' => array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'th', 'values' => array( 'Table Heading', 'Table Heading', 'Table Heading', 'Table Heading' ) ) ) ) ), array( 'tag' => 'tfoot', 'child' => array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Footer', 'Table Footer', 'Table Footer', 'Table Footer' ) ) ) ) ), array( 'tag' => 'tbody', 'child' => array( 'children' => array( array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ), array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ), array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ), array( 'tag' => 'tr', 'child' => array( 'loop' => array( 'tag' => 'td', 'values' => array( 'Table Data', 'Table Data', 'Table Data', 'Table Data' ) ) ) ) ) ) ) ) )); ?> <!-- Output --> <table class='uk-table'> <caption>Table caption</caption> <thead> <tr> <th>Table Heading</th> <th>Table Heading</th> <th>Table Heading</th> <th>Table Heading</th> </tr> </thead> <tfoot> <tr> <td>Table Footer</td> <td>Table Footer</td> <td>Table Footer</td> <td>Table Footer</td> </tr> </tfoot> <tbody> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> <tr> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> <td>Table Data</td> </tr> </tbody> </table> You can make nested calls !
  2. @kongondo Thanks for your module ! I made a pull-request for separating status urls from status labels. I opened an issue for original ProcessCommentsManager, because problem coming from the original module. On my side i am using your module with my changes its look like working well !
  3. ukyo

    AvbImage

    When you call image and if image exist not trying to create it again just bringing existing image data.
  4. You can use : getLanguageValue($language->id, 'url') or $page->localHttpUrl($language->id); or $page->localUrl($language->id); for get language values Example usage for get all urls for all languages: <?php $getLanguageValues = ""; $localHttpUrls = ""; foreach($languages as $language) { $getLanguageValues .= $page->getLanguageValue($language->id, 'url') . "<br />"; $localHttpUrls .= $page->localHttpUrl($language->id) . "<br />"; } echo "getLanguageValue() => " . $getLanguageValues; echo "localHttpUrl() => " . $localHttpUrls; ?>
  5. ukyo

    AvbImage

    Module updated Module and InterventionImage Library update
  6. Thanks for quick response. It look like ok now. I tested it with default (3) ready to use fields.
  7. I have problem with image field inside repeater. Firstly i think its caused from ProcessWire core but ryan checked issue and issue cause from this module. You can see issue details in here : https://github.com/ryancramerdesign/ProcessWire/issues/1541
  8. Updated module on dev branch. New features for v.0.0.9 dev branch : Added hook method ___beforeRender(), you can check hook example for usage Added multiple icons library use option Added Ionicons Library Now module using cdn for load icon fonts Also if you need custom icon font options you can use berforeRender hook ! After some test i will update also master branch. if you want to make test, you need to download and update it manually.
  9. Sorry i missed to update Fieldtype and Markup versions. But you need to wait for PorcesswireModuleDirectory update repos or you can make update by downloading files from github.
  10. I updated module, on my side i don't have this issue anymore ! Updated many things and changed methods for loading icon list etc.. Next step is use other font icons !
  11. Sorry i am to busy with work and i know the issue. I think this issue appear, because fonticonpicker js library changing the processwire field attributes. I will do one more hidden field for fonticonpicker js attributes and after done i will update processwire field. Started to work on it. Thanks for interest !
  12. Both (with your module and with my module) used default quality option "90" and GD library used. Didn't test "Imagick" Library yet but it must work, if extension is installed. I checked difference between "Imagick" and "GD" there not much difference about file sizes. Comments about "Imagick" quality is much better for compression than "GD".
  13. I wrote my own module. Because, I have a project need to finish it quickly. On my side file sizes are important. With your module. if you apply watermark file sizes going up (this is normal but x2 size up, not normal) On the screenshots you can see the results. If you want have a look to my module here is a link : https://processwire.com/talk/topic/11318-avbimage/ And on attachment you can see my module result :
  14. Use an images field on your template and if you have a field with ckeditor there is an image icon click it and you will see uploaded images to your page. Select image and make your align left, right or center. Save the page After you did these steps add class to your css file about alignments you can find sample css codes here : https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/templates-admin/styles/main.css#L432 Also if you add description on your uploaded image, alt tag will be appear with your description.
  15. Can you try this : /** * Uikit Navbar Navigation * * @param $items * @param array $templates * @param string $tag * @param int $maxDepth * @return string */ function renderNavigation($items, $templates=[], $tag="", $maxDepth=0) { $templates = (!empty($templates)) ? $templates : []; $currentPage = wire('page'); $output = ($tag!="") ? "\n<div class='uk-dropdown uk-dropdown-navbar'><$tag class='uk-nav uk-nav-navbar'>" : ""; foreach($items as $item) { $class = []; $dropdown = ""; $hasChild = FALSE; $url = $item->url; $caret = ""; $filter = ""; if(! empty($templates) && !in_array($item->template, $templates) && $maxDepth) { $filter = "template!="; $x=1; foreach($templates as $template) { $i=$x++; $separator = ($i!=count($templates)) ? "|" : ""; $filter .= $template.$separator; } if($item->numChildren($filter) > 0) { $hasChild = TRUE; $class[] = 'uk-parent'; $url = '#'; $dropdown = " data-uk-dropdown"; $caret = " <span class='uk-icon-angle-down'></span>"; } } // Set Active Class ! if($currentPage->id == $item->id || $currentPage->parents("id=$item->id,template!=home")->count() > 0) $class[] = 'uk-active'; $class = (!empty($class)) ? " class='" . implode(' ', $class) . "'" : ""; $output .= "\n<li{$class}{$dropdown}><a href='{$url}' title='{$item->title}'>{$item->title}{$caret}</a>"; if($hasChild) $output .= renderNavigation($item->children($filter), $templates, "ul", $maxDepth-1); $output .= "\n</li>"; } $output .= ($tag!="") ? "\n</$tag></div>" : ""; return $output; } // Usage : $homepage = $pages->get(1); $navigation = renderNavigation($homepage->and($homepage->children), array("don't", "display", "these templates", "children"), "", 1); echo "\n<nav class='uk-navbar'> \n\t<ul class='uk-navbar-nav uk-hidden-small'> \n\t\t{$navigation} \n\t</ul> \n</nav>";
  16. Check example codes on profiles come with ProcessWire. Here is an example about getting language code from homepage url : https://github.com/ryancramerdesign/ProcessWire/blob/dev/site-languages/templates/_main.php#L53
  17. ukyo

    AvbImage

    AvbImage - Image Manipulator Module for ProcessWire This module using Intervention Image PHP image handling and manipulation library. Update Status Module and InterventionImage Library update - 10-12-2015 More performance imporements - 18-11-2015 Module Update and Performance Improvements - 17-11-2015 First Commit - 28-10-2015 RequirementsProcessWire >= 2.5.11 PHP >=5.4 Fileinfo Extension Supported Image LibrariesGD Library (>=2.0) Imagick PHP extension (>=6.5.7) For usage and methods please look githup repo : README.md > For issues and fix and corrections please use Githup Repo
  18. On my side, i tested some methods for add resized or watermarked images to variations for admin panel : If i change your suffix and if i use variation name like ProcessWire (width x height) : // From $suffix = "-pim2-{$suffix}"; // To $suffix = ".pim2.{$suffix}"; // And making watermarking by use variation like ProcessWire // Watermark from original $dImage = $image->pim2Load("{$image->width}x{$image->height}")->watermarkLogo($wmPath, 'c', '2')->pimSave(); // Create medium size from original with watermark $mImg = $image->pim2Load("1130x500")->resize(1130, 500)->watermarkLogo($wmPath, 'c', '2')->pimSave(); // Use medium size for resize (will be watermarked making only resize) $mImg = $mImg->size(750, 300); Created files on disk : Here created variations : Original Size Watermarked Medium Size Watermarked I am not displaying original image. Displaying watermarked and sized images. Like this if i delete images from admin panel delete image and variations, clean work. Now the problem is file sizes as you see on my screen shot. Order : Original Image - Watermarked from Original image - Resized from watermarked original image Edited: File sizes screenshot added.
  19. You are right but I can't see variations on admin panel. This is why i am resizing original image again with same width.
  20. Thank you for this Great Module ! I stuck with variations. Without resize image by using ProcessWire api variations not working. If i use ProcessWire sizing api with pim2Load function there are many files (no need them). What i want to do : 1- Make a duplicate from original and keep original 2- Apply watermark to duplicated image 3- If result is fine for resize size, use this image for resizing (OR) resize from original and apply watermark, but don't make duplicates (for better watermark result) 4- See variations on admin panel, if i delete all images or specified image, delete all variations. (Deletion not working with below codes, if i delete image on filesystem i can see all watermarked images) // Also i tried with pim2Load('wmi')->stepResize(image->width)->watermarkLogo($wmPath, 'c', '2')->pimSave(); $duplicateAndWatermarkOriginal = $image->pim2Load('wmi')->watermarkLogo($wmPath, 'c', '2')->pimSave(); // Create a small sized 1130x500px // Also i tried with pim2Load('wmi')->stepResize(1130, 500)->watermarkLogo($wmPath, 'c', '2')->pimSave(); $smallFromDuplicated = $duplicateAndWatermarkOriginal->size(1130, 500); Watermarked images is working and not regenerating them. Also i added a log message to your class. For check whats happened. if('page'==$this->entryItem) { $this->message("pageImage setFilename, setOriginal, targetFilename :: {$targetFilename}", Notice::log); $pageimage = clone $this->pageimage; $pageimage->setFilename($targetFilename); $pageimage->setOriginal($this->pageimage); return $pageimage; } And i can have logs messages. Sometimes i can see variations count going up (from 2 variations to 4 variations) on list view of images but when i click variations its going down (from 4 variations to 2 variation) and on the list created images not appear. Now i am running script like this and variations are working : // Duplicated from original (same size), and apply watermark (here we have 2 original size without watermark and 1 with watermark) $dImage = $image->size($image->width)->pim2Load('wmi')->watermarkLogo($wmPath, 'c', '2')->pimSave(); // Create small size from $dImage already watermarked (not have a duplicate ) $sSizeImage = $dImage->size(1130, 500); // If i want to create from original again (we have one more duplicate) $sSizeFromOriginal = $image->size(1130, 500)->pim2Load('wmismall')->watermarkLogo($wmPath, 'c', '2')->pimSave();
  21. After several years use Twitter Bootstrap changed my front-end framework. What i tried : - Materializecss - Google Web Starter Kit - Foundation - Yahoo Purecss - Some other frameworks and some of other twitter bootstrap things I found Uikit, it's has simple and effective solutions. Many time you don't need extra js libraries and design is clean (this is important for me).
  22. Nice work @Mike Rockett ! I am using my own FormBuilder generally, a config file based form builder Six months ago i created a git repo uploaded files but can't finalize it. If you interest and want to check it maybe you can use some useful things : https://github.com/trk/AvbFormBuilder It has a validation library and google re-captcha support. Some of features : - Form generation - Mail send - Validation - Re-captcha support - Template support for custom input elements - etc.. Its working on my side but need to make it better.
  23. I am busy with other projects and didn't check it again but i will check it. For the moment i don't have a solution.
  24. You can test recacptcha also on localhost ! But be sure you are using virtual host or when you create a key be sure there is your local domain also added.
×
×
  • Create New...