Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/04/2013 in all areas

  1. Pwired, See my post (#11) above. I refer to this tutorial. The same principle can be used to use fields as chunks. MODX defines chunks as bits of static text which you can reuse across your site. In PW, chunks do not have to be text. They can be images, for instance. Based on that tutorial, the basics are: Create the fields you will need to hold chunk data. Choose from the different field types and settings as you require. Also for each field, fill in other helpful information such as field label. You can go further and add settings such as maximum length of field, placeholder text, etc. Example chunks could be a text field to hold contact information, company slogan, some footer text, etc. Create a chunks template. Call it chunks_template or whatever you fancy. Don't associate it with any template file. Edit and save the chunks_template to add the fields you have created to use as chunks. In the settings, you may wish to disable the "May Pages using this template have children?". Later, once you have done #3 below, you can also disable the "Can this template be used for new pages" setting. Create a chunks page that will be exclusively used to hold your chunks. You can call it "chunks". Let this page use your chunks template in #2 above. Mark the page as hidden but publish it. You will be able to access/use the chunk fields but this page will not appear in menus. Use PW API to grab and spit out your chunks where you want them to appear in your site (see examples in the wiki tutorial). For instance, assuming you named your chunks page "chunks" and have a contact information field called "contact_info" as one of your chunks field, you could grab and display this using the following code in your template file(s) associated with your other pages (i.e. other template files and not the chunks template ): <?php echo $pages->get("/chunks/")->contact_info; ?> Using this method, true to the philosophy of chunks, you can edit once and update all instances of the chunks. Even better, you edit everything in one place (page). You can do other fancy things such as: use Fieldset fields to group your chunks by "category" in your chunks page. E.g. contacts category, site meta information category, etc. Use PHP if statements to display chunks on certain pages and not others, on certain days, seasons, etc. The possibilities are endless. Do things like this to explode and display chunk data entered as a delimited list. Note: these other "fancy" things are not limited to using fields as chunks in this way....they are just examples Hope this helps Cheers /k
    4 points
  2. -edit: i hate this forum, every time you take a second too long to come up with a reply someone else steps in and beats you to it - Look at it this way, you will have to create the fields for holding *any kind of data* anyway. I don't think there will be a lot of overhead in adding all the fields to one template. From a UI perspective look at FieldsetTabOpen: You could just have your 'title, body, images' on the main content tab. Additional fields for Reviews and/or Graphics can be put on 1 or multiple other 'tab(s)' in the user interface. It's an easily overlooked feature but very useful: in 95% of page creations you won't visually be bothered by fields that are on other tabs.
    3 points
  3. PW Images Manager (beta) Just a weird little screencast trying to show how it works. (out of date a little, tags now use a textfield for easy copy/paste) This module allows you to manage images from one central repository. You create a root page "/images/" where you can then add categories and images as pages. From there the new admin page created "ImagesManager" will show categories and images added in a ajax data table, from where you can see and search/filter all images, upload and create new categories and edit images too. Every image will also show an image tag generated to copy into a textarea. This tag looks like this: {image=/path/to/image/imagename/, width=200}The width=100 is the thumbnail size used to output the image.You can also have additional segment to contain classes: {image=/path/to/image/imagename/, width=100, class=align_left}Or you can enter the id directly: {image=1033, width=100}Once inserted into a textarea field it will get parsed when saved and loaded automaticly. It will store an abstract id tag in Database and convert it back to the image HTML tag. So after first save you'll see the image inserted in a Wysiwyg and be able to resize and place it as usual. Once it's inserted somewhere Images Manager will show a search link with the pages containing the image (you can configure the fields int the module setting). You can change the image or move it to a different category, it will still work and show the correct image. This also works with multi-language fields.You can still also use the regular insert image dialog in TinyMCE and chose image from those pages. And it will start keeping track of those as well (they're the same after all). You can use those central images pages also with page fields to reference them single or even whole categories, search them with API and do what you like. Images Manager will also parse the page render on front-end and replace any found image tags with the HTML code. It will also look for a description on the image and output it as alt tag. If you want to have multi-language description you can add a `image_description` TextLanguage field to the image page template and have images parser use them. Along with this module, you can also install the `PageListImageLabel` module to add thumbnails to the image pages in the tree. To get it working you need to have the basic setup: 1. Create new `image` field with input setting to 1 max image 2. Create new `image` template and add `title` and the `image` field created before 3. Create a 'image-category' template with only title and allow the `image` template and `image-category` as child pages under family settings. 4. Create a `image-root` template with only the title field for the root of the images tree. Allow only `image-category` as child page under family settings. 5. Create the root page with the `image-root` under the home page as "/images/" 6. Done. The structure of the image repository looks like this /images/ /cagetory1/ /imagesxy/ /category2/ /image2/ /image3/ Now you can use the ImagesManager to add categories and images. But you can also still use the page tree to add new stuff as usual. The root path, template names and fields are configurable in the module settings. How to install the module: - Download the contents of this repository and put the folder renamed as "ImagesManager" into your site/modules/ folder - Login in to ProcessWire and got to Modules page and click "Check for new modules". You should see a note that the two new module were found. Install the "ImagesManager" module. - A new admin page "ImagesManager" should appear in the top menu. - You may configure the option on the module screen to suit your needs. Download at github https://github.com/somatonic/ImagesManager Thanks and enjoy.
    2 points
  4. Okay, when I say music website, this is actually my own company website. This is built starting with my bootwire starter profile. It has a couple of interesting bits: It uses the Mediaelements jquery plugin for the audio to make it cross browser compatible (each audio file is in both mp3 and ogg format). It uses the explode tip I put in another post for posting the audio, allowing me to post one or several audio slugs at a time. It has a modified version of Jack Moore's tabs to which I have added slideup and down for a more interesting look - that is used on the front page with the three images. Each page can have either the default top banner or a custom one. I have also used a bit of JQuery to create a TOC on the fly for a couple of the longer articles and then rendered it with the Bootstrap Affix plugin. This can be toggled on and off on a page by page basis. Couple of other bits. If the site is running slow, that is not ProcessWire, I seem to be having some network difficulties with Cloudflare at the moment. http://www.dancingbear.co.uk Joss
    2 points
  5. - If an image is shoot with a camera so that the Top becomes the right side, (it is rotated 90 degrees clockwise), this is stored in the EXIF-Orientation-Flag. - If a software rotates this image 90 degrees counterclockwise and do not setup the EXIF-Orientation-Flag this is bad for every following software that relies on the EXIF-Oriantation-Flag, but GD2 doesn't do that. My question: does the MS-Photo Viewer really changes the orientation / rotation of an image ? or does it only show them rotated but doesn't alter the files? Can you make three copies of an image and let the first original from camera, the second rotated with MS-Photo-Viewer and the third saved with XnView and send it to me (ZIP 2 PM or upload here)?
    2 points
  6. You can go even shorter if you want to <title><?=$page->{'alt_title|title'}?></title>
    2 points
  7. I've added an httpUrl() function to the Pagefile class on my local dev copy, so this should be appearing on the dev branch soon. Ideally there should be a corresponding httpUrl() function anywhere there is a url() function.
    2 points
  8. I knew it but just wanted to leave some room for improvement so you guys also have something to write.
    2 points
  9. hint: if you know the answer, just click "Post" and then edit post
    2 points
  10. Or look in the status bar while hovering a page edit link, this can be quicker diogo - resident forum ninja - strikes, once again
    2 points
  11. 100 sounds like a limit to me... edit: another option would be to have a hidden page called "navigation" with a pageFieldType multiple in it where you could list the pages. 97 to go
    2 points
  12. If you have more than one template, you will force the editor to choose each time, while if you have only one, you can force the children of one age to use that template removing this step when creating a page. The ideal for you is to use field sets or tabs. Play a bit with the fieldstypes FieldSetOpen and FieldSetTabOpen. The first allows you to group a set of fields and even collapse them under a common bar. The second moves those fields to a new tab.
    2 points
  13. Hi KentBrockman, welcome to ProcessWire. There are two reasons why it doen't work: 1) $pages->get will return only one page. If you want multiple pages, you have to use $pages->find which returns a PageArray. 2) You need the OR selector: id=1|1001|1003 So you could try this: $myPages = $pages->find("id=1|1001|1003"); foreach ($myPages as $p) { echo $p->title; } To make this more dynamic, you could add a checkbox field to the templates of pages you want to list, let's call the field "show_nav". Then check the checkbox on the pages you want to appear and update the code: $myPages = $pages->find("show_nav=1"); Of course this is only one possible solution out of 100 (infinity), with ProcessWire you have no limits
    2 points
  14. Hi Folks, today we will learn how to set up a simple jquery plugin called calendario and fill events trough our admin backend. || ATTENTION || Modern Browser needed First of all, we need the jquery plugin. Grab your copy here: http://tympanus.net/...alendar-plugin/ Now create a new template file, lets call the file calendar.php In the next step we have to include all the needed files from the .zip package. You need the following .css files: calendar.css custom_2.css demo.css Just include them in the <head> </head> of your template file. Feel free to merge them together, so you could save some http connects. Now we need to include the needed javascript. Make sure you have included the latest jQuery library. Include the jquery.calendario.js and the modernizr.custom.63321.js right into the bottom of your template file. Save the calendar.php Now we will set up Processwire where the magic wil happen. We just need one new template. Create a new template called calendar. Assign the field headline to our template. Allow children to just use this template. Hit the save button. Now create a new Page as child of home and call it Calendar. Assign our calendar template to this page. Almost ready. Now we have to do some little scripting in our template file calendar.php Add this html markup to our calendar.php <div class="custom-calendar-wrap"> <div id="custom-inner" class="custom-inner"> <div class="custom-header clearfix"> <nav> <span id="custom-prev" class="custom-prev"></span> <span id="custom-next" class="custom-next"></span> </nav> <h2 id="custom-month" class="custom-month"></h2> <h3 id="custom-year" class="custom-year"></h3> </div> <div id="calendar" class="fc-calendar-container"></div> </div> </div> Now we have to call the javascript function, to get the calendar running. Just put this snippet right under the included jquery.calendario.js <script type="text/javascript" $(function() { var transEndEventNames = { 'WebkitTransition' : 'webkitTransitionend', 'MozTransition' : 'transitionend', 'OTransition' : 'oTransitionend', 'msTransition' : 'MSTransitionend', 'transition' : 'transitionend' }, transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], $wrapper = $( '#custom-inner' ), $calendar = $( '#calendar' ), cal = $calendar.calendario( { onDayClick : function( $el, $contentEl, dateProperties ) { if( $contentEl.length > 0 ) { showEvents( $contentEl, dateProperties ); } }, caldata : { <?= getEvents(); ?> // this is our function to grab our events }, displayWeekAbbr : false } ), $month = $( '#custom-month' ).html( cal.getMonthName() ), $year = $( '#custom-year' ).html( cal.getYear() ); $( '#custom-next' ).on( 'click', function() { cal.gotoNextMonth( updateMonthYear ); } ); $( '#custom-today' ).on( 'click', function() { cal.gotoNow( updateMonthYear ); } ); $( '#custom-prev' ).on( 'click', function() { cal.gotoPreviousMonth( updateMonthYear ); } ); function updateMonthYear() { $month.html( cal.getMonthName() ); $year.html( cal.getYear() ); } // just an example.. function showEvents( $contentEl, dateProperties ) { hideEvents(); var $events = $( '<div id="custom-content-reveal" class="custom-content-reveal"><h4>Termine am ' + dateProperties.day + '. ' + dateProperties.monthname + ' ' + dateProperties.year + '</h4></div>' ), $close = $( '<span class="custom-content-close"></span>' ).on( 'click', hideEvents ); $events.append( $contentEl.html() , $close ).insertAfter( $wrapper ); setTimeout( function() { $events.css( 'top', '0%' ); }, 25 ); } function hideEvents() { var $events = $( '#custom-content-reveal' ); if( $events.length > 0 ) { $events.css( 'top', '100%' ); Modernizr.csstransitions ? $events.on( transEndEventName, function() { $( this ).remove(); } ) : $events.remove(); } } }); </script> We are almost finished, but we are missing some very essential, have a look to our javascript. We are calling a function named getEvents() This function will grab our events and fire it right to our calendar. So here is the code: function getEvents() { $events = wire('pages')->get("/calendar/")->children(); foreach ($events as $event) { echo "'$event->title' : '<span>$event->headline</span> ',"; } } Put this snippet above the javascript includes. We will now create our first entry. Go back to the PW admin backend and create a Child of Calendar. Title and name need the Date on which the event has to be displayed. You have to form a date in this format: mm-dd-yyyy e.g. 12-27-2012. The headline field is our Event description. Hit the save button, go to your site and enjoy your event calendar. With a little coding you could extend the calendar to let it look like mine attached as screenshot. Hope this was useful to somebody. Cheerio.
    1 point
  15. Hi, for german native speaker i found this: http://lukasepple.de/blog/2012/08/grundlagen-processwire/#x - Thanks Lukas
    1 point
  16. I found myself searching for an smooth workflow to collaboratively work on a process wire project and had the challenge of including the mysql data into version control to keep it in sync with the rest of process wire. Here is a solution with git hooks, that Ben Kubertis came up with: http://ben.kulbertis...-and-git-hooks/ Step 1: When commiting you want to fetch the latest changes of the database. Edit the "pre-commit.sample" hook located in /YourRepoDirectory/.git/hooks/ #!/bin/sh mysqldump -u [db_user] -p[db_password] --skip-extended-insert [db_name] > /PathToYourRepo/database.sql cd /PathToYourRepo/ git add database.sql Enter your mysql login details and git repository paths and then save and rename it to "pre-commit" That way each time you commit, any changes of the db will be downloaded and kept under version control Please note: If you only have modified the database and didn't touch any other files, you will have to manually pull the database updates, since git commit needs "changed files" to successfully commit. Step 2: When you checkout or merge branches, then you always want to fire up the belonging database again. Create another two hooks named "post-merge" and "post-checkout" with the following content: mysql -u [db_user] -p[db_password] [db_name] < /PathToYourRepo/database.sql NOTE: !!! Please test this first on a dummy project, in order to not mess your database up !!! When working with MAMP you probably have to add the path to mysql and mysqldump as well; Simply put /Applications/MAMP/Library/bin/ in front of it
    1 point
  17. Hi Guys I'm doing the unthinkable and attempting to recreate cmscritic.com with processwire. A task that I'm sure will be incredibly fulfilling once complete and I'm hoping will teach me how to use this CMS in the process. (pun not intended). I'm messing with the blog profile at the moment and when I look at the template, I see it's got a field "site title" which when viewing the page, is populated with the words "Basic Blog Profile" and used in the masthead. Since I want to use an image logo instead and have it easy to change within the backend, I added an image field to the template and uploaded my logo. The issue i'm having is that I'm unsure as to how to call this and within which template. I can see it in the page now as an uploaded image but I don't know how to call it within the masthead. Tough to explain, hopefully my question makes sense. Here's a screenie to show what I mean. Thanks in advance! Mike
    1 point
  18. Hi there and welcome to the forums. I'm a little short in time right now so i won't go into specifics about search with dropdowns. Some general info: - I don't think that there is a dedicated page on this site detailing the security(features) of PW but you can be assured that it is excellent security-wise. A strong password mechanism, session fingerprinting and a lot more. I haven't heard of PW installs being hacked or otherwise compromised. - PW can be an excellent way to get acquainted with PHP (programming). Some basic PHP combined with some PW API 'magic' will enable you to become productive in a short period of time. Of course, if your serious about learning PHP it will require some effort to learn a language and general concepts of programming. - The best advice i can give is just install PW and do some tutorials that are on the wiki. Once it all starts to make sense definitely read through the API documentation on the site. - Also, browse the forums. A lot of great info can be found, although admittedly sometimes a bit hard to find. Post like this could be interesting for you
    1 point
  19. Peter, i think you are missing something because that module in essence allows for exactly what you are after. You can define shortcodes for basically any combination of html/php/js you wish. The whole power of raw php and PW API is at your fingertips. After you have defined your shortcodes they can be used in any text field in the PW admin, including tinymce/ckeditor fields just by using [tagnamehere] . An example from Nico: <?php //Template code $shortcode = $modules->get('MarkupShortcodes'); $shortcode->add('config.urls.root', function($atts){ return $config->urls->root; }); $shortcode->add('config.urls.templates', function($atts){ return $config->urls->templates; }); $shortcode->add('url', function($atts){ return $page->url; }); $shortcode->add('id', function($atts){ return $page->id; }); echo $shortcode->render($page->body); //end template code. // the shortcodes can then be used in a textarea/tinymce (in this case the body field) with [config.urls.root] , [url] etc. ?> Read carefully through this http://processwire.com/talk/topic/1819-markupshortcodes/ , you'll get the hang of it.
    1 point
  20. Code example tomorrow, just arrived at home, le me now @ couch
    1 point
  21. Thanks Kongondo, that sure helped for another modx refugee, pw beginner.
    1 point
  22. You can use the module in a text field also, but because it will look for <p> tags around the video, make sure you also choose textile or markdown before the video formatter on that same field. It works, but it's a lot of unnecessary processing for something that simple. Or you could do this without a module. Just create a video ID field, and embed the video like this echo "<iframe width='560' height='315' src='http://www.youtube.com/embed/{$page->videoID_field}'></iframe>"; If you want to control some aspects of the player add as many of these parameters as you wish to the video url https://developers.google.com/youtube/player_parameters echo "<iframe width='560' height='315' src='http://www.youtube.com/embed/{$page->video_id}?autoplay=1&theme=light'></iframe>"; And if you want, those parameters can be dynamic: echo "<iframe width='560' height='315' src='http://www.youtube.com/embed/{$page->video_id}?autoplay={$page->video_autoplay}&theme={$page->video_theme}'></iframe>";
    1 point
  23. I'm not sure that I understand exactly what you are trying to do with asmSelect? But it is fairly straightforward to replace the "add new page" process. To do this, copy the existing /wire/modules/Process/ProcessPageAdd/* to /site/modules/ProcessPageAddLuis/. Then rename the class and filenames to ProcessPageAddLuis. Now login to your admin and install the ProcssPageAddLuis module. Then navigate in the tree to Pages > Admin > Page > Add New Page. Edit the "Add New Page" page. Change the "process" field from ProcessPageAdd to ProcessPageAddLuis. Save. Now edit your new module to work how you want it to. It should be safe through upgrades as well.
    1 point
  24. @arjen: Oh, seems you better understood what is going on with the images. I only have read orientation == rotation. @Ronnie: if your images are not rotated (top is not shown at top), you can ignore my post. Sorry, haven't got it right. My rule for the next few weeks: If want to help, first read carefully the question, second read more carefully the question and third only do answer after understanding it right.
    1 point
  25. Hi Ronnie and welcome! This sounds that the images you try to upload are originally have a rotation when created. Currently PW doesn't check/recognize the EXIF-orientation-flag in the Core-ImageSizer. But we have already included an autocorrection in the Email-Image-Module, so the code for that is already there (amongst with code for sharpening after downsizing!). But it has to get included into the core somehow. I've started to prepare code with that to send it Ryan so that he can test it, optionally modifiy it and finally add it to the core. But I#m short of time at the moment and can't say when it is done. I bet you localy use an imageviewer that autocorrects the rotation when displaying the images. As a workaround you may try opening an image in a image-app like photoshop, do something like brightness +1% and then -1% and save it. Photoshop autocorrects the rotation when opening the image and also resets the EXIF-orientation-flag when saving the image. This also should work with most other image-manipulation-apps. Edit: The planned additions should be usable also for the Thumbnail-Module. Here are a short screencast about manually sharpening.
    1 point
  26. uses: $results=$pages->getById($ides) ; muches faster!! then get() ones.by one and in.right orders they will.be
    1 point
  27. Or hover the edit link on the tree and see it on the status bar of the browser.
    1 point
  28. Look in the url of the browser while editting a page: /processwire/page/edit/?id=1007
    1 point
  29. I don't think wappalyzer claims to be 100% correct, but if we take a vanilla installation of PW i think the combination of things above is enough reason to assume something is PW. The fact that you could quite easily make some customisations so that it can't be detected doesn't invalidate the wappalyzer tool (not that i particulary like it though). I'm thinking of adding <meta name="generator" content="Joomla! - Open Source Content Management - Version 3.0.0" /> to my templates just to throw them off.
    1 point
  30. A straight up export->import of database dumps from dev to live seems like a disaster waiting to happen. Definitely read this: http://processwire.com/talk/topic/1284-best-practice-for-staging-to-live-database-synchronization/#entry12752 I would also look into some tools that aid in comparing and syncing. Did some Googling: http://blog.webyog.com/2012/10/16/so-how-do-you-sync-your-database-schema/ http://stackoverflow.com/questions/225772/compare-two-mysql-databases http://blog.webyog.com/2012/10/23/all-you-wanted-to-know-about-sqlyogs-schema-comparison-tool/ http://www.red-gate.com/products/sql-development/sql-compare/screenshots http://www.quest.com/toad-for-mysql/
    1 point
  31. Nico: http://try.github.com/levels/1/challenges/1 http://rogerdudler.github.com/git-guide/ http://ndpsoftware.com/git-cheatsheet.html
    1 point
  32. Wanze, thank you for your fast answer to our question. Your solution works right "out-of-the-box". By looking at it again ("id=1,1001,1003") is truly embarrassing. Grüße aus Deutschland.
    1 point
  33. do that.in selector must you.not accept only feld name does sort= math haveu.given it $lat_min=blahblahmath; $lat_max=ur_fancy_maths_here; $lng_max=some_science_here; $lng_min=mom_taught_well; $pages->find("parent=/shop-locator/stores/, map_location.lat>=$lat_min, map_location.lng>=$lng_min, map_location.lat<=$lat_max, map_location.lng<=$lng_max, sort=map_location.lat, sort=map_location.lng"); or.mabe querry db.direct u may enjoy ? $r=$db->query("select pages_id from field_map_location where ..."); $ides=array(); while($row=$r->fetch_row()) $ides[] = $row[0]; $results=$pages->find("id=" . implode('|', $ides));
    1 point
  34. thanks Soma - btw have you considered a flattr account... i 'flattred' a few of your modules...
    1 point
  35. Well I'm using the GitHub mac app because I don't have any idea how to use git via terminal
    1 point
  36. 1 point
  37. Just re-read your message, and just wanted to make this clear: I do not make assumptions about your design. When I ask questions, challenge your ideas, or propose alternatives, I'm merely testing the boat to see if it holds water - it's nothing personal, it's just the way my mind works. And most of the time, you are able to clarify your objectives or explain your choices to my satisfaction ... as Einstein said, "question everything" - this is how we arrive, not at perfection, but as you say, the best possible choices gives the context and goals. Please assume that I'm trying to help - if my tone suggests otherwise, I apologize, I'm not always eloquent with my words. I never got on the Drupal, Joomla or WordPress forums to try to help there - because I never saw any of those projects as being worth my time. This project is. So I hope you'll put up with me, even if I ask obnoxious or provocative questions at times. As Rafael Dohms just pointed out on Twitter: Discussion is evolution, whether you are right or wrong the exercise of discussing will teach you something new.
    1 point
  38. add this in header $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, editable: false, events: "json-code.php", eventRender: function(event, element, view ) { if (view.name === "agendaDay") { element.find('.fc-event-title').append("<br/>" + event.description); } }, eventDrop: function(event, delta) { alert(event.title + ' was moved ' + delta + ' days\n' + '(should probably update your database)'); }, loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); } }); $oldTable.remove(); this in json-code.php function pagesToJSON(PageArray $events) { $json = array(); foreach($events as $event) { $json[] = pageToArray($event); } return json_encode($json); } function pageToArray(Page $event) { $data = array( 'id' => $event->id, 'title' => $event->title, 'start' => date("Y-m-d H:i:s",$event->date_start), 'end' => date("Y-m-d H:i:s",$event->date_end), 'url' => "$event->url", // event ID is the url segment 'description' => "$event->summary", 'allDay' => false, ); return $data; } // end else $calendarPosts=$wire->pages->get('/events/')->children(); echo pagesToJSON($calendarPosts); end in page where you want the calendar, <div class="tab-pane" id="calendary"> <div id='loading' style='display:none'>loading...</div> <div id='calendar' class='calendar-page'></div> </div>
    1 point
  39. You're in luck http://modules.processwire.com/modules/markup-htmlpurifier/
    1 point
  40. PW can handle x thousands of pages easily. Image Manager is using ajax based data table to list and search/filter those pages, so it scales infinitely. Also the abstraction of the images in texts uses page ID's searches, and this is pretty fast. So you could go as far as your server limit. It's not more intensive than PW itself. ImagesManager doesn't add a noticeable overhead. You could use this for all images, but still also use the on page image field where it makes sense. However when sharing images and inserting those in Textareas, I think ImagesManager approach and its abstract feature is a big plus in handling those. It's still alpha and it's possible some things may change on the way to a first RC. So it's not for use in production yet.
    1 point
  41. This is a little php tip that might come in useful for those who are new to this php stuff (like me) Repeater fields are wonderful in ProcessWire, but if, like me today, you are faced with a list of a hundred odd items, then they can become a little overwhelming to use. Sometimes all you want to do is put a list in a textarea and hope something wonderful will come of it. Well, Explode in php is just the wonderful thing you might want. In this example I am creating a simple list where each list item has three parts - a name, a type and a colour. Create a textarea field and add it to your template. Create a page and in the textarea add your list - something like this, perhaps? Ford Fiesta,1.3xl,red Morris Marina,GT,blue Hilman Hunter,1.6SE,green There are two delimiters here - a new line between each car entry (yes, those are all cars) and a comma between each detail of the car. On our template, we first grab our textarea and "explode" it to separate the lines into an array: $cars = explode("\n", $page->my_textarea); "\n" is the new line markup and we are identifying it within $page->my_textarea and then exploding at those points. We now need to loop through out array: foreach($cars as $car) { All familiar so far. However, we need to split up those comma delimited bits so we can deal with them separately. We will use explode again: $car = explode(',', $car); In this case we are identifying the comma within the string $car and exploding it. This has now created an array of bits that we can access with indexes. So here is a completed version: <?php $cars = explode("\n", $page->my_textarea); foreach($cars as $car) { $car = explode(',', $car); echo "<h3>{$car[0]}</h3>"; echo "<p>Car Model: {$car[1]}</p>"; echo "<p>Car Colour: {$car[2]}</p>"; echo "<hr>"; } ?> The indexes are within the square brackets and start from zero - though you can use them in any order, of course! And there you are - looping happily through your long list. I have just used the same principle to list 100 music tracks on my new site which I will showcase in a day or so. Obviously, you could have achieved the same thing with repeaters and had the luxury of being able to reorder them and edit them easily - but sometimes all you want is a silly list, and this method does silly lists very well. Joss PS: Thanks to Apeisa, because I stole this from his Thumbnails module!
    1 point
  42. Thanks for this, Joss. It's nice to have not only PW but also PHP tutorials here It should probably also be noted that an alternative method for handling CSV strings (which your list there seems to be, though admittedly a very simple one) is to use str_getcsv, which is available since PHP 5.3.0. In the context of your sample code it would look like this: <?php $cars = explode("\n", $page->my_textarea); foreach($cars as $car) { $car = str_getcsv($car); echo "<h3>{$car[0]}</h3>"; echo "<p>Car Model: {$car[1]}</p>"; echo "<p>Car Colour: {$car[2]}</p>"; echo "<hr>"; } There's not much difference between these two methods really, as far as I know even performance-wise they are pretty much equal. Still if there's even a small possibility that you'd need to handle more complex CSV content at some point, using str_getcsv makes sense -- that way you won't need to worry about things like commas inside quotes, escaped characters etc.
    1 point
  43. OOh Not sure. I have them working using the right click context menu (less mess on the tool bar) Here is my standard set up: theme_advanced_buttons1 formatselect,styleselect,|,bold,italic,|,bullist,numlist,|,link,unlink,|,image,|,code,|,fullscreen,spellchecker theme_advanced_blockformats p,h1,h2,h3,h4,blockquote,pre,code plugins inlinepopups,safari,table,media,paste,fullscreen,preelementfix,contextmenu valid_elements @[id|class|style],a[href|target|name],strong/b,em/i,br,img[src|id|class|width|height|alt],ul,ol,li,p[class],h1,h2,h3,h4,blockquote,-p,-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],pre,code Additional TinyMCE Settings paste_text_sticky: true paste_text_sticky_default:true (Those two settings remove all formatting when you paste) Third Party Plugins spellchecker : /site/tinymce/myplugins/spellchecker (I have installed the spell checker in the above path) Hopefully that should help! Joss
    1 point
  44. Your best guess is a good one. It was a mod_security problem. It only started happening after the host switched from Apache to LiteSpeed so I made the leap it was an incompatibility with litespeed but it may have only been a result of how the server was configured. They commented out the mod_security rule and things went back to normal.
    1 point
  45. Hi, now it's working, i don't now why but now it's all fine. Thanks a lot
    1 point
  46. Awesome work! One of the coolest PW sites I've seen.
    1 point
  47. I just moved a site from my local MAMP to the production server and could not login. I tried everything suggest here in the forum, but the "forged" message remained. Because I did not want to upload all sessions I excluded the "/site/assets/sessions/" folder when uploading the site by ftp. As soon as I created the "/site/assets/sessions/" folder by hand on the server everything worked again. Conclusion: Remember that you need these folders: /site/assets/cache/ /site/assets/logs/ /site/assets/sessions/
    1 point
  48. I feel with this guy... I like this system it's so clever and smooth! But for non-coders, it's very very difficult. Which is a pitty, because it's so worth for more people to like and use it!
    1 point
  49. Of course, this also depends what framework you are using. For instance, if you use the Crop image field and then associate that with Bootstrap, you can specify using different thumbnails for different media queries. In addition, you can add classes in Bootstrap to either show or not show elements for various devices. (Other frameworks have similar approaches) Mixing and matching this way allows not only different sizes, but because of using the crop image, you can also change the area of the image viewed. So on the desktop the thumbnail image might be a landscape, but on a phone where that would bad, you would have a close up of one distinctive element in the image. It has been one of the joys of the Thumbnails plugin that I can easily spend time thinking about not just what size an image should be, but also the context - whether that is in relation to the surrounding text, or the size of the browser.
    1 point
  50. This is the code I ended up using, thanks again to interrobang, diogo and Ryan: $blogposts = $pages->get( "/blog/" )->children; $comments = array(); foreach( $blogposts as $blogpost ) { foreach($blogpost->comment as $comment) { if($comment->isApproved()) { array_push($comments, array("comment"=>$comment, "post"=>$blogpost)); } } } if($comments) { $out = "<h2>Last three blog comments</h2>"; $out .= "<dl>"; arsort($comments); $num_comments = 0; foreach($comments as $comment) { $cite = htmlentities($comment["comment"]->cite); $text = htmlentities($comment["comment"]->text); $date = date("j M 'y ", $comment["comment"]->created); $comment_parent_url = $comment["post"]->url . "#Comment" . $comment["comment"]; $out .= "<dt><a href='{$comment_parent_url}'>{$date}</a></dt>"; $out .= "<dd>{$cite}</dd>"; $out .= "<dd>{$text}</dd>"; $num_comments++; if($num_comments == 3) break; } $out .= "</dl>"; echo $out; } else { echo "<p>No comments.</p>"; } Brilliant. Thanks guys! Updated 2012-06-14-1329 to use named arrays, much better, thanks to diogo for suggesting this
    1 point
×
×
  • Create New...