Leaderboard
Popular Content
Showing content with the highest reputation on 11/25/2015 in all areas
-
Here's a little Hanna Code snippet I wrote that allows you to insert a tag that contains any HTML element of your choice along with any attributes. The only defined Hanna Code variables are "element" and "comment". If you leave element empty, it will automatically use the "div" HTML element. The "comment" variable is optional and doesn't get outputted on the frontend. It is only for internal use and if you want to actually describe what the Hanna Code is doing. Import these two into Hanna Code: "tag" !HannaCode:tag:eyJuYW1lIjoidGFnIiwidHlwZSI6IjIiLCJjb2RlIjoiXC8qaGNfYXR0clxuZWxlbWVudD1cImRpdlwiXG5jb21tZW50PVwiXCJcbmhjX2F0dHIqXC9cbjw/cGhwXG5cL1wvaWYoIGVtcHR5KCRhdHRyW1wiZWxlbWVudFwiXSkgKSByZXR1cm47XG4kcmV0dXJuID0gJzwnLiRhdHRyW1wiZWxlbWVudFwiXTtcbmZvcmVhY2goJGF0dHIgYXMgJGsgPT4gJGEpIHtcbiAgICBpZiggJGsgPT0gXCJlbGVtZW50XCIgfHwgJGsgPT0gXCJjb21tZW50XCIgKSBjb250aW51ZTtcbiAgICBpZiggIWVtcHR5KCRhKSApICRyZXR1cm4gLj0gJyAnLiRrLic9XCInLiRhLidcIic7XG59XG4kcmV0dXJuIC49ICc+JztcbmVjaG8gJHJldHVybjsifQ==/!HannaCode "end-tag" !HannaCode:end-tag:eyJuYW1lIjoiZW5kLXRhZyIsInR5cGUiOiIyIiwiY29kZSI6IlwvKmhjX2F0dHJcbmVsZW1lbnQ9XCJkaXZcIlxuaGNfYXR0cipcL1xuPD9waHBcblwvXC9pZiggZW1wdHkoJGF0dHJbXCJlbGVtZW50XCJdKSApIHJldHVybjtcbiRyZXR1cm4gPSAnPFwvJy4kYXR0cltcImVsZW1lbnRcIl0uJz4nO1xuZWNobyAkcmV0dXJuOyJ9/!HannaCode Now for some examples: Example 1: Section [[tag element="section"]] will output... <section> Example 2: Section with class [[tag element="section" class="myclass myotherclass"]] will output... <section class="myclass myotherclass"> Example 3: Section with id [[tag element="section" id="myid"]] will output... <section id="myid"> Example 4: Section with inline styles [[tag element="section" style="color:red"]] will output... <section style="color:red"> Example 5: Section with any attributes you want (data attributes for instance) [[tag element="section" my-custom-attribute="test-value" data-something="cool"]] will output... <section my-custom-attribute="test-value" data-something="cool"> Example 6: Same as above with "element" not defined (defaults to "div") [[tag my-custom-attribute="test-value" data-something="cool"]] will output... <div my-custom-attribute="test-value" data-something="cool"> Example 7: Same as above with "comment" set (which does not get outputted) [[tag my-custom-attribute="test-value" data-something="cool" comment="Don't remove this line or your page will get totally messed up!"]] will output... <div my-custom-attribute="test-value" data-something="cool"> Example 8: Close section tag [[end-tag element="section"]] will output... </section> Example 9: Close div tag [[end-tag]] will output... </div> Example with a common Bootstrap rows and columns scenario: [[tag class="row"]] [[tag class="col-sm-6"]] This is the first col. [[end-tag comment="end of first col"]] [[tag class="col-sm-6"]] This is the first col. [[end-tag comment="end of second col"]] [[end-tag comment="end of row"]] -- Note the following article regarding the terms "element" and "tag": http://perfectionkills.com/tag-is-not-an-element-or-is-it/5 points
-
nice challenge for the evening with a happy end create a javascript file scripts/limitpageselect.js: // my field is called "pageselect" $(window).load(function() { if($('#Inputfield_pageselect :selected').length > 4) $('#Inputfield_pageselect').siblings('select').hide(); $('#Inputfield_pageselect').change(function() { if($('#Inputfield_pageselect :selected').length > 4) { $(this).siblings('select').hide(); } else { $(this).siblings('select').show(); } }); }); and inject this file via hook in /site/ready.php $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event){ $process = $event->object; $page = $process->getPage(); if($page->template != 'basic-page') return; // set your template name here $config = wire('config'); $config->scripts->append($config->urls->templates . 'scripts/limitpageselect.js'); });5 points
-
4 points
-
Moin Moin, hello and terre! The focus of this website is the large amount of high quality kitesurfing videos and tricks. I choosed that niche because I'm a kiteboarder and there was no site which was focussed on kitesurf media. So... here it is: http://www.steeze-kiteboarding.de/ This was my first website with PW and I think i fell in love I wrote some modules for my own... for example to display the images with a "watersign" directly through the input of the vimeo/youtube URL and convert these URLs for my iframes. Have fun! Feedback, haters and fans are welcome! Best regards!3 points
-
/site/ready.php $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event){ $process = $event->object; $page = $process->getPage(); $config = wire('config'); if($page->template == 'basic-page') { $config->scripts->append($config->urls->templates . 'scripts/pagefieldclearbutton.js'); } }); /site/scripts/pagefieldclearbutton.js $(window).load(function() { $('ul.PageListActions').append('<li class="PageListActionSelect PageFieldClearButton"><a href="#">Unselect</a></li>'); $('.PageFieldClearButton').click(function() { $(this).parent().siblings('p.PageListSelectName').html(''); $('#Inputfield_pageselect').val(''); }); }); working starting point. maybe someone wants to take this further... as you can see it jumps to the pagetop for now2 points
-
Powered by <a href="http://processwire.com">P<span class="no-mobile">rocess</span>W<span class="no-mobile">ire</span></a>2 points
-
Fixed the problem where WireMailSMTP is being bypassed in favour of WireMail... @justb3a I would usually leave module code 100% alone, but comparing how mail is called in another site I noticed it was different, so I edited `SimpleContactForm.module` around line 478 like this: // Below original module code bypasses WireMailSMTP // $wireMail = new WireMail(); // Below does not bypass WireMailSMTP $wireMail = wireMail(); and email is then sent via WireMailSMTP. If I edit it back to the original then it bypasses WireMailSMTP and I can switch back and forth depending on how I leave the code around line 478. If this is this something you would like me to log on git etc then please let me know as I would love to have an official (unedited) copy of your excellent module that used WireMailSMTP. Sorry if I explained that all badly and thanks again for this module, cheers, -Alan2 points
-
--------------------------------------------------------------------------------------------------------------------------------- when working with PW version 2.6+, please use Pim2, not Pim! read more here on how to change from the older to the newer version in existing sites --------------------------------------------------------------------------------------------------------------------------------- PageImage Manipulator, API for version 1 & 2 The Page Image Manipulator is a module that let you in a first place do ImageManipulations with your PageImages. - And in a second place there is the possibility to let it work on any imagefile that exists in your servers filesystem, regardless if it is a 'known PW-image'. The Page Image Manipulator is a Toolbox for Users and Moduledevelopers. It is written to be as close to the Core ImageSizer as possible. Besides the GD-filterfunctions it contains resize, crop, canvas, rotate, flip, sharpen, unsharpMask and 3 watermark methods. How does it work? You can enter the ImageManipulator by calling the method pim2Load(). After that you can chain together how many actions in what ever order you like. If your manipulation is finished, you call pimSave() to write the memory Image into a diskfile. pimSave() returns the PageImage-Object of the new written file so we are able to further use any known PW-image property or method. This way it integrates best into the ProcessWire flow. The three examples above put out the same visual result: a grayscale image with a width of 240px. Only the filenames will slightly differ. You have to define a name-prefix that you pass with the pimLoad() method. If the file with that prefix already exists, all operations are skipped and only the desired PageImage-Object gets returned by pimSave(). If you want to force recreation of the file, you can pass as second param a boolean true: pim2Load('myPrefix', true). You may also want to get rid of all variations at once? Than you can call $pageimage->pim2Load('myPrefix')->removePimVariations()! A complete list of all methods and actions are at the end of this post. You may also visit the post with tips & examples for users and module developers. How to Install Download the module Place the module files in /site/modules/PageImageManipulator/ In your admin, click Modules > Check for new modules Click "install" for PageImageManipulator Done! There are no configuration settings needed, just install and use it. Download (version 0.2.0) get it from the Modules Directory History of origins http://processwire.com/talk/topic/3278-core-imagemanipulation/ ---------------------------------------------------------------------------------------------------------- Page Image Manipulator - Methods * pimLoad or pim2Load, depends on the version you use! pimLoad($prefix, $param2=optional, $param3=optional) param 1: $prefix - (string) = mandatory! param 2: mixed, $forceRecreation or $options param 3: mixed, $forceRecreation or $options return: pim - (class handle) $options - (array) default is empty, see the next method for a list of valid options! $forceRecreation - (bool) default is false It check if the desired image variation exists, if not or if forceRecreation is set to true, it prepares all settings to get ready for image manipulation ------------------------------------------------------------------- * setOptions setOptions(array $options) param: $options - (array) default is empty return: pim - (class handle) Takes an array with any number valid options / properties and set them by replacing the class-defaults and / or the global config defaults optionally set in the site/config.php under imageSizerOptions or imageManipulatorOptions. valid options are: quality = 1 - 100 (integer) upscaling = true | false (boolean) cropping = true | false (boolean) autoRotation =true | false (boolean) sharpening = 'none' | 'soft' | 'medium' | 'strong' (string) bgcolor = (array) css rgb or css rgba, first three values are integer 0-255 and optional 4 value is float 0-1, - default is array(255,255,255,0) thumbnailColorizeCustom = (array) rgb with values for colorize, integer -255 - 255 (this can be used to set a custom color when working together with Thumbnails-Module) outputFormat = 'gif' | 'jpg' | 'png' (Attention: outputFormat cannot be specified as global option in $config->imageManipulatorOptions!) set {singleOption} ($value) For every valid option there is also a single method that you can call, like setQuality(90), setUpscaling(false), etc. ------------------------------------------------------------------- * pimSave pimSave() return: PageImage-Object If a new image is hold in memory, it saves the current content into a diskfile, according to the settings of filename, imagetype, targetFilename and outputFormat. Returns a PageImage-Object! ------------------------------------------------------------------- * release release() return: void (nothing) if you, for what ever reason, first load image into memory but than do not save it, you should call release() to do the dishes! ? If you use pimSave() to leave the ImageManipulator, release() is called automatically. ------------------------------------------------------------------- * getOptions getOptions() return: associative array with all final option values example: ["autoRotation"] bool(true) ["upscaling"] bool(false) ["cropping"] bool(true) ["quality"] int(90) ["sharpening"] string(6) "medium" ["targetFilename"] string(96) "/htdocs/site/assets/files/1124/pim_prefix_filename.jpg" ["outputFormat"] string(3) "jpg" get {singleOption} () For every valid option there is also a single method that you can call, like getQuality(), getUpscaling(), etc. See method setOptions for a list of valid options! ------------------------------------------------------------------- * getImageInfo getImageInfo() return: associative array with useful informations of source imagefile example: ["type"] string(3) "jpg" ["imageType"] int(2) ["mimetype"] string(10) "image/jpeg" ["width"] int(500) ["height"] int(331) ["landscape"] bool(true) ["ratio"] float(1.5105740181269) ["bits"] int(8) ["channels"] int(3) ["colspace"] string(9) "DeviceRGB" ------------------------------------------------------------------- * getPimVariations getPimVariations() return: array of Pageimages Collect all pimVariations of this Pageimage as a Pageimages array of Pageimage objects. All variations created by the core ImageSizer are not included in the collection. ------------------------------------------------------------------- * removePimVariations removePimVariations() return: pim - (class handle) Removes all image variations that was created using the PIM, all variations that are created by the core ImageSizer are left untouched! ------------------------------------------------------------------- * width width($dst_width, $sharpen_mode=null) param: $dst_width - (integer) param: $auto_sharpen - (boolean) default is true was deleted with version 0.0.8, - sorry for breaking compatibility param: $sharpen_mode - (string) possible: 'none' | 'soft' | 'medium' | 'strong', default is 'soft' return: pim - (class handle) Is a call to resize where you prioritize the width, like with pageimage. Additionally, after resizing, an automatic sharpening can be done with one of the three modes. ------------------------------------------------------------------- * height height($dst_height, $sharpen_mode=null) param: $dst_height - (integer) param: $auto_sharpen - (boolean) default is true was deleted with version 0.0.8, - sorry for breaking compatibility param: $sharpen_mode - (string) possible: 'none' | 'soft' | 'medium' | 'strong', default is 'soft' return: pim - (class handle) Is a call to resize where you prioritize the height, like with pageimage. Additionally, after resizing, an automatic sharpening can be done with one of the three modes. ------------------------------------------------------------------- * resize resize($dst_width=0, $dst_height=0, $sharpen_mode=null) param: $dst_width - (integer) default is 0 param: $dst_height - (integer) default is 0 param: $auto_sharpen - (boolean) default is true was deleted with version 0.0.8, - sorry for breaking compatibility param: $sharpen_mode - (string) possible: 'none' | 'soft' | 'medium' | 'strong', default is 'soft' return: pim - (class handle) Is a call to resize where you have to set width and / or height, like with pageimage size(). Additionally, after resizing, an automatic sharpening can be done with one of the three modes. ------------------------------------------------------------------- * stepResize stepResize($dst_width=0, $dst_height=0) param: $dst_width - (integer) default is 0 param: $dst_height - (integer) default is 0 return: pim - (class handle) this performs a resizing but with multiple little steps, each step followed by a soft sharpening. That way you can get better result of sharpened images. ------------------------------------------------------------------- * sharpen sharpen($mode='soft') param: $mode - (string) possible values 'none' | 'soft'| 'medium'| 'strong' return: pim - (class handle) Applys sharpening to the current memory image. You can call it with one of the three predefined pattern, or you can pass an array with your own pattern. ------------------------------------------------------------------- * unsharpMask unsharpMask($amount, $radius, $threshold) param: $amount - (integer) 0 - 500, default is 100 param: $radius - (float) 0.1 - 50, default is 0.5 param: $threshold - (integer) 0 - 255, default is 3 return: pim - (class handle) Applys sharpening to the current memory image like the equal named filter in photoshop. Credit for the used unsharp mask algorithm goes to Torstein Hønsi who has created the function back in 2003. ------------------------------------------------------------------- * smooth smooth($level=127) param: $level - (integer) 1 - 255, default is 127 return: pim - (class handle) Smooth is the opposite of sharpen. You can define how strong it should be applied, 1 is low and 255 is strong. ------------------------------------------------------------------- * blur blur() return: pim - (class handle) Blur is like smooth, but cannot called with a value. It seems to be similar like a result of smooth with a value greater than 200. ------------------------------------------------------------------- * crop crop($pos_x, $pos_y, $width, $height) param: $pos_x - (integer) start position left param: $pos_y - (integer) start position top param: $width - (integer) horizontal length of desired image part param: $height - (integer) vertical length of desired image part return: pim - (class handle) This method cut out a part of the memory image. ------------------------------------------------------------------- * canvas canvas($width, $height, $bgcolor, $position, $padding) param: $width = mixed, associative array with options or integer, - mandatory! param: $height = integer, - mandatory if $width is integer! param: $bgcolor = array with rgb or rgba, - default is array(255, 255, 255, 0) param: $position = one out of north, northwest, center, etc, - default is center param: $padding = integer as percent of canvas length, - default is 0 return: pim - (class handle) This method creates a canvas according to the given width and height and position the memory image onto it. You can pass an associative options array as the first and only param. With it you have to set width and height and optionally any other valid param. Or you have to set at least width and height as integers. Hint: If you want use transparency with rgba and your sourceImage isn't of type PNG, you have to define 'png' as outputFormat with your initially options array or, for example, like this: $image->pimLoad('prefix')->setOutputFormat('png')->canvas(300, 300, array(210,233,238,0.5), 'c', 5)->pimSave() ------------------------------------------------------------------- * flip flip($vertical=false) param: $vertical - (boolean) default is false return: pim - (class handle) This flips the image horizontal by default. (mirroring) If the boolean param is set to true, it flips the image vertical instead. ------------------------------------------------------------------- * rotate rotate($degree, $backgroundColor=127) param: $degree - (integer) valid is -360 0 360 param: $backgroundColor - (integer) valid is 0 - 255, default is 127 return: pim - (class handle) This rotates the image. Positive values for degree rotates clockwise, negative values counter clockwise. If you use other values than 90, 180, 270, the additional space gets filled with the defined background color. ------------------------------------------------------------------- * brightness brightness($level) param: $level - (integer) -255 0 255 return: pim - (class handle) You can adjust brightness by defining a value between -255 and +255. Zero lets it unchanged, negative values results in darker images and positive values in lighter images. ------------------------------------------------------------------- * contrast contrast($level) param: $level - (integer) -255 0 255 return: pim - (class handle) You can adjust contrast by defining a value between -255 and +255. Zero lets it unchanged, negative values results in lesser contrast and positive values in higher contrast. ------------------------------------------------------------------- * grayscale grayscale() return: pim - (class handle) Turns an image into grayscale. Remove all colors. ------------------------------------------------------------------- * sepia sepia() return: pim - (class handle) Turns the memory image into a colorized grayscale image with a predefined rgb-color that is known as "sepia". ------------------------------------------------------------------- * colorize colorize($anyColor) param: $anyColor - (array) like css rgb or css rgba - but with values for rgb -255 - +255, - value for alpha is float 0 - 1, 0 = transparent 1 = opaque return: pim - (class handle) Here you can adjust each of the RGB colors and optionally the alpha channel. Zero lets the channel unchanged whereas negative values results in lesser / darker parts of that channel and higher values in stronger saturisation of that channel. ------------------------------------------------------------------- * negate negate() return: pim - (class handle) Turns an image into a "negative". ------------------------------------------------------------------- * pixelate pixelate($blockSize=3) param: $blockSize - (integer) 1 - ??, default is 3 return: pim - (class handle) This apply the well known PixelLook to the memory image. It is stronger with higher values for blockSize. ------------------------------------------------------------------- * emboss emboss() return: pim - (class handle) This apply the emboss effect to the memory image. ------------------------------------------------------------------- * edgedetect edgedetect() return: pim - (class handle) This apply the edge-detect effect to the memory image. ------------------------------------------------------------------- * getMemoryImage getMemoryImage() return: memoryimage - (GD-Resource) If you want apply something that isn't available with that class, you simply can check out the current memory image and apply your image - voodoo - stuff ------------------------------------------------------------------- * setMemoryImage setMemoryImage($memoryImage) param: $memoryImage - (GD-Resource) return: pim - (class handle) If you are ready with your own image stuff, you can check in the memory image for further use with the class. ------------------------------------------------------------------- * watermarkLogo watermarkLogo($pngAlphaImage, $position='center', $padding=2) param: $pngAlphaImage - mixed [systemfilepath or PageImageObject] to/from a PNG with transparency param: $position - (string) is one out of: N, E, S, W, C, NE, SE, SW, NW, - or: north, east, south, west, center, northeast, southeast, southwest, northwest default is 'center' param: $padding - (integer) 0 - 25, default is 5, padding to the borders in percent of the images length! return: pim - (class handle) You can pass a transparent image with its filename or as a PageImage to the method. If the watermark is bigger than the destination-image, it gets shrinked to fit into the targetimage. If it is a small watermark image you can define the position of it: NW - N - NE | | | W - C - E | | | SW - S - SE The easiest and best way I have discovered to apply a big transparency watermark to an image is as follows: create a square transparent png image of e.g. 2000 x 2000 px, place your mark into the center with enough (percent) of space to the borders. You can see an example here! The $pngAlphaImage get centered and shrinked to fit into the memory image. No hassle with what width and / or height should I use?, how many space for the borders?, etc. ------------------------------------------------------------------- * watermarkLogoTiled watermarkLogoTiled($pngAlphaImage) param: $pngAlphaImage - mixed [systemfilepath or PageImageObject] to/from a PNG with transparency return: pim - (class handle) Here you have to pass a tile png with transparency (e.g. something between 150-300 px?) to your bigger images. It got repeated all over the memory image starting at the top left corner. ------------------------------------------------------------------- * watermarkText watermarkText($text, $size=10, $position='center', $padding=2, $opacity=50, $trueTypeFont=null) param: $text - (string) the text that you want to display on the image param: $size - (integer) 1 - 100, unit = points, good value seems to be around 10 to 15 param: $position - (string) is one out of: N, E, S, W, C, NE, SE, SW, NW, - or: north, east, south, west, center, northeast, southeast, southwest, northwest default is 'center' param: $padding - (integer) 0 - 25, default is 2, padding to the borders in percent of the images length! param: $opacity- (integer) 1 - 100, default is 50 param: $trueTypeFont - (string) systemfilepath to a TrueTypeFont, default is freesansbold.ttf (is GPL & comes with the module) return: pim - (class handle) Here you can display (dynamic) text with transparency over the memory image. You have to define your text, and optionally size, position, padding, opacity for it. And if you don't like the default font, freesansbold, you have to point to a TrueTypeFont-File of your choice. Please have a look to example output: http://processwire.com/talk/topic/4264-release-page-image-manipulator/page-2#entry41989 ------------------------------------------------------------------- PageImage Manipulator - Example Output1 point
-
InputfieldURLChecker This is a tiny module to add a URL check button to InputfieldURL. It's live, meaning that it opens what you just typed in, and visible only if the field is non-empty. It's as unobtrusive as can Modules directory GitHub It would be the best if something similar would be built-in to PW. There will be probably some tweaks and settings in the future. Suggestions welcome (even for module name).1 point
-
Hi all In Bootstrap 3.1.1 If you have a header page that has a child page, the main page cannot be linkable. So you have to duplicate the main page to be the first child of itself. The result will be: Home - Main Page (Not linkable) -- Main Page (Linkable to the upper page) -- divider (Please not I also make the line brake 'divider' to appear only here, you can change it back like it was or whatever you want depending on your needs) -- Sub Page (Linkable) -- Sub Page (Linkable) Instead of: Home - Main Page (Not linkable) -- Sub Page (Linkable) -- Sub Page (Linkable) I am not code writer so I take the renderTopNav function from the Zurb Foundation 4 Site Profile Version 1.0.1 made by Ryan and play with it a bit. here is the original function from Zurb Foundation 4 Site Profile: function renderTopNav(PageArray $items, array $options = array(), $level = 0) { $defaults = array( 'tree' => 2, // number of levels it should recurse into the tree 'dividers' => true, 'repeat' => true, // whether to repeat items with children as first item in their children nav ); $options = array_merge($defaults, $options); $divider = $options['dividers'] ? "<li class='divider'></li>" : ""; $page = wire('page'); $out = ''; foreach($items as $item) { $numChildren = $item->numChildren(true); if($level+1 > $options['tree'] || $item->id == 1) $numChildren = 0; $class = ''; if($numChildren) $class .= "has-dropdown "; if($page->id == $item->id) $class .= "current "; if(($item->id > 1 && $page->parents->has($item)) || $page->id == $item->id) $class .= "active "; if($class) $class = " class='" . trim($class) . "'"; $out .= "$divider<li$class><a href='$item->url'>$item->title</a>"; if($numChildren) { $out .= "<ul class='dropdown'>"; if($options['repeat']) $out .= "$divider<li><a href='$item->url'>$item->title</a></li>"; $out .= renderTopNav($item->children, $options, $level+1); $out .= "</ul>"; } $out .= "</li>"; } return $out; } And here what I came up with: function renderTopNav(PageArray $items, array $options = array(), $level = 0) { $defaults = array( 'tree' => 1, // number of levels it should recurse into the tree must be only 1 'dividers' => true, 'repeat' => true, // whether to repeat items with children as first item in their children nav ); $options = array_merge($defaults, $options); $divider = $options['dividers'] ? "<li class='divider'></li>\n" : ""; $page = wire('page'); $out = ''; foreach($items as $item) { $numChildren = $item->numChildren(true); if($level+1 > $options['tree'] || $item->id == 1) $numChildren = 0; $class = ''; $toggle = ''; $caret = ''; if($numChildren) $class .= "dropdown "; if($numChildren) $toggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; if($numChildren) $caret .= ' <b class="caret"></b>'; if(($item->id > 1 && $page->parents->has($item)) || $page->id == $item->id) $class .= "active "; if($class) $class = " class='" . trim($class) . "'"; $out .= "<li$class><a$toggle href='$item->url'>$item->title$caret</a>"; if($numChildren) { $out .= "<ul class='dropdown-menu'>\n"; if($options['repeat']) $out .= "<li><a href='$item->url'>$item->title</a></li>\n$divider\n"; $out .= renderTopNav($item->children, $options, $level+1); $out .= "</ul>\n"; } $out .= "</li>\n"; } return $out; } Usage: <nav class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Brand</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <?php echo renderTopNav($homepage->children->prepend($homepage)); // call renderTopNav function ?> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> Please feel free to edit, fix, redistribute or whatever you need to do to help others. Thanks1 point
-
1 point
-
You can use insertBefore, eg: $newField = $fields->get("your_new_field"); $t = $templates->get("your_template_name"); $existingField = $t->fields->get("sitemap_ignore_END"); $fg = $t->fieldgroup; $fg->insertBefore($newField, $existingField); $fg->save();1 point
-
@alan: WOW! What a great find. You are right. I have checked this and yes, on the site I thought it would working together, it also bypasses SMTP as you described it. @justb3a: please can you fix this with one of the next releases?1 point
-
echo $page->parent->title; echo $page->parent->name; echo $page->parent->id; echo $page->parent->whatever_property;// non-array property1 point
-
The user is abled to create his own profile and then he can post his last sessions via UI. Every user got his own subpage in the PW backend and there he can store his sessions without using the PW backend in his browser. The spots and tricks are dynamic generated out of the spot and trick list with an auto-completer. If the user is entering an unknown spot, I'll get a mail with it and can put it to the map. The user is also abled to declare his blog as a private blog, just for members or visible to everyone. Thank you for your comments! I'm planning a relaunch of the website (make it wider and full responsive) and I'm happy about your feedback, so I can transfer it to the relaunch. Best regards!1 point
-
Welcome to the forum. You should read some tutorials, like this one. http://processwire.com/docs/tutorials/simple-website-tutorials/ In ProcessWire nearly everything is a $page (even users, roles, permissions) If you want to assign more fields to the user template. Create the fields, you need Go to templates. Select Filters, Show system templates Select template 'user' and add any field you have in your system If you want to see the fields in the user profile, you have to add them in the settings of Module ProcessProfile.1 point
-
Some improvements in the JS: $(window).load(function () { var fieldName = 'tags_recipe', // add field name here limit = 5, // set limit here asmSelector = '#Inputfield_' + fieldName; $(asmSelector).on('change limitItems', function () { var obj = $(this).parent().find('.asmSelect'); $(this).find(':selected').length >= limit ? obj.attr('disabled', 1) : obj.removeAttr('disabled'); }); $(asmSelector).trigger('limitItems'); }); What would be nice is to add the "limit" in the backend to the asmSelect using a "data-limit" attribute and then let JavaScript do its part on all asmSelects which have data-limit set.1 point
-
@LostKobraKai Wouldn't you actually need window.onload or $(window).load for that? $(document).ready fires when the DOM is ready and does not wait for all resources like scripts/images. See here and here.1 point
-
1 point
-
Hi BernhardB, I have a small module that injects a script tag right before </body>. Here's the relevant lines public function init() { $this->addHookAfter('Page::render', $this, 'addInlineScript'); } public function addInlineScript($event) { $page = $event->object; if ($page->template->name !== "admin" && $page->inlineScript) { $event->return = str_replace("</body>", $page->inlineScript . "</body>", $event->return); } } You can adjust that to your situation. Hope it helps.1 point
-
Frontend members area is no problem at all with PW. You just need to build the login logic via API. I built this with no prior experience with help from the forum. Now there is also a module out there: http://modules.processwire.com/modules/frontend-user/ And this thread is worth reading. Going on from there you either use Form Builder for your forms or you create them via the API and do validation etc yourself. As for the paypal integration, I have no experience myself. But you may find some useful info/code here: https://processwire.com/talk/topic/5281-paypal-payment-method-for-processwire-shop/1 point
-
$page is of the admin template for everything you visit in the backend. But most of the time you're interested in the page your editing and not the "admin page" your on.1 point
-
I had this issue once with a client site for a photographer. It turned out to be a color profile issue, like mentioned by elabx. Converting images to sRGB before upload solved it for me.1 point
-
What has happened to me is that photos that como straight from a camera, specially a DSRL, sometimes have Pro Photo RGB or some kind of fancy color profile that when viewed in browser, it tends to look desaturated. You could check this by opening you photos in Photoshop and check for the color profile.1 point
-
I wonder if it's better to wrap the whole hook in such a condition: if($page->template === 'basic-page') { $wire->addHookAfter(...) }1 point
-
@horst I checked and SCF is 0.1.2 which is the latest at the moment = ✔ header says "...X-Mailer: ProcessWire/WireMail..." = ✖ so my setup (WireMailSMTP ver 0.1.13 on a PW 2.7.0 site and SCF) seems to be working AOK but emails are bypassing WireMailSMTP @justb3a and/or @horst : if there is anything I could do here to help fix this for me (and I assume others) then I would be happy to try stuff and report back/thanks for any suggestions you may have1 point
-
@horst Thanks for the suggestions, I will check and report back in case it's of any help to others.1 point
-
Facebook might seem nice from the outside, but it's actually a damn lot of work to get any reach without paying facebook to advertise the company. Without regular (daily at best) posts you'll hardly get visitors beyond the people who actually know you already. The agency vs. single dev argument might be true, but that's the case for every single freelancer no matter of the industry. I think the best way to get along with that is a strong portfolio and optionally a small high quality set of partners and fellow devs (of other strengths), which you can rely on in bigger projects. Especially if they have a strong portfolio as well you can certainly assure clients that they'll get the same quality as they can expect from an similarly sized agency. Surely you can't do the job a whole team of people is doing in an agency, especially in a similar timeframe. So to get the really big projects one needs to have a critical number of people on board.1 point
-
here's a quick way to change the slider increment for your date timepicker, (this would go in AdminCustomFiles/ProcessPageEdit.js): if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { stepMinute: 15, }; $.timepicker.setDefaults($.timepicker.custom); }); } if you run the latest version of timepicker addon (1.6.1) you can use selects instead of sliders: (for example if you are on current dev/stable, you copy the inputfield to site/modules and tell the system to use that one; then upgrade to the latest timepicker, and copy the new css to the datetime css; if are on devns, word is that it will include the latest version of timepicker). if(typeof $.timepicker != 'undefined') { $(function(){ $.timepicker.custom = { stepMinute: 15, controlType: 'select', oneLine: true, }; $.timepicker.setDefaults($.timepicker.custom); }); }1 point
-
@justb3a Thanks, yes the token is there and since I undid the reindenting of code it works AOK. Also thanks I have used the log to see what was wrong (very helpful, I also spotted that my test emails had hit the IP address limit per day so I upped it for testing @horst Thanks, yes I assumed that it was used. But I am pretty sure it's not being used... History: I installed and used SCF to send email (via PW built in wiremail I assume). Then I installed WireMailSMTP and set it to use my Mandrill credentials. But email is arriving without showing Mandrill as the sender (view email headers also shows no mention of Mandrill.com) and based on all my other uses of WiremailSMTP+Mandrill I assume (where Mandrill is listed) I assume this mean Mandrill and therefore WireMailSMTP are being bypassed (I guess?). Env: • WireMailSMTP passes it's connectivity test. • I have debug turned on. If there's anything I can do to help test what may be happening I'd be happy to test and report. Thanks in advance for any suggestions.1 point
-
Thank you for the snippets, I used them to build a little Module to handle multi-language Image Descriptions and further image informations. Have a look at the module FieldtypeImageExtra.1 point