Leaderboard
Popular Content
Showing content with the highest reputation on 08/16/2013 in all areas
-
Just feeling the love today for this incredible system. As with most great things, you tend to take them for granted after a while but I just had a realisation today of just how important ProcessWire is to my working life and the thought of having to use any other tool is too depressing for words! Thanks once again Mr Cramer13 points
-
I've just pushed some fairly major updates to this module for version 2.0.0: Add zoom to the data managed by this module. It can be accessed from your field in the same way as address, lat and lng, i.e. $page->map->zoom. It will remember your zoom level setting from the page editor, and it can be used for generating your own maps. The map settings are now configurable in the field settings (input tab). This includes the starting/default location for the map, map height, default zoom level and map type. Removed some annoying behaviors from the geocoder. The client-side (javascript) and server-side geocoders no longer try to complete with each other. InputfieldMapMarker is now responsive so that it's input organization is just as usable at mobile resolution. Addition of a new related Markup module: MarkupGoogleMap. This provides an easy way for you to generate maps with the data managed by FieldtypeMapMarker: $map = $modules->get('MarkupGoogleMap'); // output a map with one marker echo $map->render($page, 'map'); // or output a map with a bunch of markers: $items = $pages->find("template=something"); echo $map-render($items, 'map'); This is just a basic usage example. For all options see the README.4 points
-
3 points
-
Maybe something like this. <style> * { margin: 0; padding: 0; } ul { display: block; } li { position: relative; display: inline-block; text-align: center; } img { max-width: 80%; height: auto; } </style> ------------------------------------ $images = $page->images; $count = count($images); $width = 100 / $count $width = floor($width * 1000) / 1000; if($count) { echo "<ul>"; foreach($images as $image ) { echo "<li style='width: {$width}%;'><img src='{$image->url}' /></li>"; } echo "</ul>"; } Not tested. grr editor....( How the ... can Kongondo make posts like they are printed from a book )3 points
-
ProcessWire gives me the old Apple feeling back. ( talking about 10/15 years ago) But we have our own Steve Jobs! Ryan Cramer has the vision, the knowhow and the social aspect we all adore. I love the things that are not in the admin, and how to handle all those other aspects. (api) I don't want a assets manager ( if there's no reference ) I don't want endless settings on a shared place. I don't want to explain ( in tutorial ) how a site works. I don't want to use some kind of TPL language inserting logic in a textfield. I don't want a headache to get data. All the above I can easily build/do with ProcessWire, the fact that I can I really love.3 points
-
@Raymond: I have uploaded a new version with the positioning added! Let me know how it works. @all: there was a little bug (a 0 instaed of a 1) in the module file at Line 81 that has ignored the forceRecreation param. Please update both files to version 0.0.2 (link is in the first post) Edit: @Raymond: Yes you are right, it is really nice to have the watermark image as pageImage too. I have tried this: $img = $page->images->first(); $wmi = $page->watermark->pimLoad('wmi')->colorize('red')->pimSave(); $imgsrc = $img->pimLoad('tw',true)->width(180)->grayscale()->watermarkLogo($wmi, 'southeast', 0)->pimSave(); echo "<img src='{$imgsrc->url}' /><br />"; and a grayscale watermark becomes red. Nice! Have not thought about this possibilities before.2 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
-
I found (after 2-3 Projects using PW) that it's a good technique to use templates in a way I think hasn't been thought of yet really by some. (Although the CMS we use at work for year, works this way.) I'm sure I'm maybe wrong and someone else is already doing something similar. But I wanted to share this for everybody, just to show alternative way of using the brillant system that PW is. Delegate Template approach I tend to do a setup like this: - I create a main.php with the main html markup, no includes. So the whole html structure is there. - I then create page templates in PW without a file associated. I just name them let's say: basic-page, blog-entry, news-entry... but there's no basic-page.php actually. - Then after creating the template I make it use the "main" as alternative under "Advanced" settings tab. So it's using the main.php as the template file. - This allows to use all templates having the same php master template "main.php" - Then I create a folder and call it something like "/site/templates/view/", in which I create the inc files for the different template types. So there would be a basic-page.inc, blog-entry.inc ... - Then in the main.php template file I use following code to delegate what .inc should be included depending on the name of the template the page requested has. Using the TemplateFile functions you can use the render method, and assign variables to give to the inc explicitly, or you could also use just regular php include() technic. <?php /* * template views depending on template name * using TemplateFile method of PW */ // delegate render view template file // all page templates use "main.php" as alternative template file if( $page->template ) { $t = new TemplateFile($config->paths->templates . "view/{$page->template}.inc"); //$t->set("arr1", $somevar); echo $t->render(); } <?php /* * template views depending on template name * using regular php include */ if( $page->template ) { include($config->paths->templates . "view/{$page->template}.inc"); } I chosen this approach mainly because I hate splitting up the "main" template with head.inc and foot.inc etc. although I was also using this quite a lot, I like the delegate approach better. Having only one main.php which contains the complete html structure makes it easier for me to see/control whats going on. Hope this will be useful to someone. Cheers1 point
-
and install the autocomplete inputfield for page field for even more awe.1 point
-
For "simple" websites I use usually with a 3 column design. First column is for widgets (pages stored in /widgets/ ) with a checkbox to select it's left postion and a template where to render. I can put as many pages in the widgets folder as I wish. All left widgets wil show up on the left side of the page sorted on the drag'n'drop order if it have the right template. If there are no widgets to render, the pixel space is given back to the center column. On every page I can check a widget to disable rendering. The second column is for the main content. The third column acts the same as the first. But then for the right column. Every widget is aware of $page. So I can use widgets for "photoalbums", link to siblings, children or just to show social media urls etc etc. Maybe you can have a look at delegate profile. ( the widget system included ) Ps, Documentation doesn't belong to that version anymore. So ignore it (yeah I'm lazy) For CSS framework I used Gumbyframework. Maybe this will help you out simplifying your templates.1 point
-
you could create all the different templates you need for each sub-set page, and then tell them to use the basic-page template; that's how i do it; you should also use the rules for parents/children, that helps a lot with keeping things organized in the admin1 point
-
I was doing a favor today for someone who's stuck with a custom WP "theme" and wants some special functionality on top. Looking at all this mess, I shuddered, more than once.1 point
-
You can make a simple WireData module to put functions specific to your project you can do all sorts of things like hooks, your own helper markup generating functions for use in template or other modules, or whatever else. See the HelloWorld.module that comes with the default profile. It comes down much to preference but I do that often, and instead of including a functions.php in template it will be available everywhere. You could even go as far as setting a new API var for use in the system. In the init() of such a autoload module you would call: $this->set->fuel("projects", $this); And you'd have a $projects API var that you could call methods from your class. Or set properties to existing API vars to maybe have a $user->fullname. Possibilities are endless.1 point
-
Settings You can store in the admin. (/processwire/ if you create a structure like this: /Processwire/Settings/ <- hide from menu & enable guest access ( will show open lock ) /Settings/color/ /color/red/ /color/blue/ /color/green/ /Settings/position/ /position/top/ /position/left/ /position/right/ Then the editors won't see anything in the tree. And you can query for your color or position.1 point
-
I don't know why your init.php file doesn't work if it's included before all other files. Anyway, have you seen this in the config file? /** * prependTemplateFile: PHP file in /site/templates/ that will be loaded before each page's template file * * Uncomment and edit to enable. * */ // $config->prependTemplateFile = '_init.php';1 point
-
Greetings, The idea of selects being pages -- at first -- seems odd, because other CMSs have simpler ways to do it. But the first time you need to have multi-dimensional elements as selects, you realize how terrific this is. Just a simple example... In one of my recent projects, admins create store pages and add the location by selecting a US state. They need to see the full name of the states in the select box. I also needed to create a search that allowed visitors to find those stores by entering any or all of the state name. But, I also needed to display state abbreviations in store listing pages. Using ProcessWire selects, I just created "state" pages with the title field, as well as an "abbreviation" field, then used those pages to populate the select. The person creating the page doesn't even know the abbreviations are there. They just know that when they select the full state name, magically, the proper abbreviation shows up in the listings pages. You could go many levels down (or up) from there! Thanks, Matthew1 point
-
I created an empty language pack. Go to: Admin > Setup > Languages Create a new language Drag & Drop the attached zip-file in the Language Translation Files Field. Start to edit the files. empty-lang_pack_pw_3.0.41.zip EDIT: Obsolete in latest PW Versions. Create a language pack by your own. Go to: Admin > Setup > Languages > Add New Save Press button: 'Find Files to Translate' Select all files in the box 'Translatable files in /wire/' Select files in the box 'Translatable files in /site/' which you want to add to your custom language pack Press 'Submit' Start translating Download zip or csv file by pressing the related button at the bottom of the page where translatable files are listed. Done1 point
-
My little workaround <?php if(!$input->post->import && !$fieldsImport && !$input->post->generate): ?> <hr /> <h4>Separate Fields by comma like this: i,am,a,new,field</h4> <form name="importform" method="post" action="./"> <div class="span3"> <p><label>Field Prefix?</label> <input type="text" name="prefix" /></p> </div> <div class="span3"> <p><label>Field Tag?</label> <input type="text" name="fieldtag" /></p> </div> <div class="span3"> <p><label>assign to </label> <select name="template"> <option></option> <?php foreach($templates as $singleTemplate): ?> <option value="<?php echo $singleTemplate->name ?>"><?php echo $singleTemplate->name ?></option> <?php endforeach ?> </select> </p> </div> <div class="span12"><textarea name="string"><?php echo $input->post->string ?></textarea><p><input type="submit" name="import" value="import" /></p></div> </form> <?php endif ?> <?php if($input->post->import){ $fieldsImport = $input->post->string; $fieldsImport = explode(',', $fieldsImport); } if($fieldsImport): ?> <hr /> <form name="fieldform" method="post" action="./"> <div class="row"><div class="span12"><hr /></div></div> <ul> <?php foreach($fieldsImport as $fieldNew): ?> <?php $alleTypes = '<select class="required" name="'.$fieldNew.'"> <option selected="selected" value=""/> <option value="Checkbox">Checkbox</option> <option value="Email">Email</option> <option value="File">File</option> <option value="Image">Image</option> <option value="Page">Page</option> <option value="Text">Text</option> <option value="Textarea">Textarea</option> <option value="URL">URL</option> </select>'; ?> <li><?php echo $fieldNew ?> <?php echo $alleTypes ?></li> <?php endforeach ?> </ul> <input type="hidden" value="<?php echo $input->post->prefix ?>" name="prefix" /> <input type="hidden" value="<?php echo $input->post->template ?>" name="template" /> <input type="hidden" value="<?php echo $input->post->fieldtag ?>" name="tag" /> <input type="submit" name="generate" value="generate" /> </form> <?php endif ?> <?php if($input->post->generate){ $prefix = $input->post->prefix; $tags = $input->post->tag; $template = $input->post->template; $addedFields = $fieldgroups->get('name='.$template); foreach($input->post as $key => $val){ if($key != 'prefix' && $key != 'tag' && $key != 'generate' && $key != 'template'){ $f = new Field; if($prefix){$f->name = $prefix.'_'.$key;}else{$f->name = $key;} $f->type = $val; $f->save(); $f->tags = '-'.$tags; $f->save(); $addedFields->add($f); $addedFields->save(); echo "$key = $val <br />"; } } } ?>1 point
-
Hi Soma - thanks, checking for the original size of the image is definitely an option. I do think though that the upscaling=>false option should work with one dimension set to 0. However, this also seems to work: $options = array('upscaling'=>false,'cropping'=>false,'quality'=>90); $image->size(500,'',$options); As does this, which is maybe the most logical option: $options = array('upscaling'=>false,'cropping'=>false,'quality'=>90); $image->width(500,$options);1 point
-
Custom admin themes go in /site/templates-admin/. The /site/ structure is never touched during an upgrade, so it should be impossible to overwrite an admin theme during an upgrade. http://processwire.com/download/admin-themes/ I'm guessing you had your custom admin theme in /wire/templates-admin/ instead? Just remember that /site/ is all your stuff, and /wire/ is all ProcessWire's stuff. The reason upgrades are easy is because you can just replace your entire /wire/ directory with the new version and you are set. But that also means it's a bad idea to put any of your own stuff in /wire/. Btw, a good practice when upgrading is to bring in the new /wire/ directory under a name like /wire.new/. Then once it's there, rename your old /wire/ directory to /wire.old/, and then /wire.new/ to /wire/. Test that everything is working well. Once comfortable, delete /wire.old/. But if for some reason you noticed a problem after putting in the new /wire/ then, you can simply rename the /wire.old/ dir back to /wire/ so that you aren't suddenly in a bind and unable to revert.1 point
-
Hi Jason, if you're doing it just for a few pages, you don't need any module/plugin; you can do this simply by using templates! Create field 'redirectTo' – customizable, of course Set that field to be 'single page', and select the inputfield you wish Create template 'redirectPage' – again, custom put following code in your template file Create page that links to original page you've made your virtual page Code for your template: <?php /* * Template: redirectPage * * Used to redirect URL adress to other page with 301 HTTP code */ $session->redirect( $page->redirectTo->url ); I actually use this at least once each site.1 point