Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/02/2015 in all areas

  1. Hi everybody, the fist time I heard about PW, it was by following a simple link on a blog, and it could probably change quite many things with my next client projects. As I started doing web design and dev' somewhere around 1994, I walked through some CMS's and PHP frameworks along the way. My last CMS of choice is (and almost was) ExpressionEngine but since the first versions of EE2 there's noting new or better, just more expensive 3rd party modules adding up to the license and more. Actually, i'm considering migrating two EE websites to PW, and starting a fresh install for a client project I'm actually working on. For later, on, once I'll dig more into the source, I'll test some UX ideas locally for the Admin part to see. Oh, yep, indeed I'm Andrei, web dev/design/market'er based in southern France, and glad to be here
    6 points
  2. Hi, recently I needed some off-canvas solution for off-canvas menu. I thought that there must be some simple jquery plugin for that but i couldn't find anything. Some of theme were a part of some bigger framework which i do not prefer, or they were too complicated. So I decided to do it myself, thinking that it can't be that hard ... i just need to toggle some classes. Only experience i had with JS or jQuery is from Codecademy, which I did more than a year ago. So after a few days I had something working and I decided to put it on github. Also, had to learn github since I haven't used it before. But the problem is, although it works, performance is not that good, i tried it on smartphone and it lags. I don't know what to do, I think the problem is somewhere in my JS skills. So my question is if you have any time for checking my code and tell me how bad it is. if it is just a mess or what changes needs to be made. http://marek95.github.io/icy-off-canvas/ also, I would like to ask, what do you use when you need off-canvas? What are your usual requirements? Thanks!
    5 points
  3. $myDB = new Database('localhost', 'username', 'password', 'db_name', 3306); $result = $myDB->query("SELECT * FROM my_table"); while($row = $result->fetch_assoc()) { $p = new Page(); $p->template = "dam"; $p->parent = "something"; $p->title = $row['title']; $p->save(); }
    5 points
  4. ... that now also lives in my Editor. - http://sourcefoundry.org/hack/ - .
    3 points
  5. : Guys, this is sooooo cool !!! Having seen the modifications done to the bike, and checked with google, this is not fake, but for real !! Discharge from coding for 4 minutes and enjoy watching this => It actually starts at 1:12 .
    2 points
  6. another goodie I have found a view days ago: http://www.fnordware.com/superpng/ (Source is at https://github.com/fnordware/SuperPNG)
    2 points
  7. Wow, thanks for all your comments and suggestions guys. The ProcessWire community sure seems a friendly and helpful lot! I'll read through all the pointers you've given me and take it from there. You've certainly all given me plenty of food for thought. Thanks again, it's much appreciated. Tony.
    2 points
  8. This week like every week i've to write somewhere how great PW is... ...since i am setting up my first bigger website...i choose this threat for my lovestory... I'm just finished with a special eventcalendar....and could manage easy provide .ics files for download and saving events in outlook and many other calendars...just easy. I generate the file at runtime and deliver it. This is the admin.php magic for the right urls: /** * change page name on event pages and add the fileextention to the pagename * chreate pagename-date-id.ics as url */ $pages->addHookAfter('saveReady', null, 'addEvent'); function addEvent(HookEvent $event) { $page = $event->arguments[0]; if($page->template != 'event' ) return; //for this template only //add file extention $fileext = ".ics"; $newName = wire('sanitizer')->pageName($page->title, true); $date = date("Y-m-d", $page->getUnformatted("event_start_date")); $page->name = $newName .'-'. $date .'-'. $page->id . $fileext; $page->message($page->name); } and then just put this in the frontendtemplate: <?php //set correct content-type-header header('Content-type: text/calendar; charset=utf-8'); header('Content-Disposition: inline; filename=calendar.ics'); //get the data for the ical file and create output... and for shure i've this line in my vevent filled with PW as iCalendar Generator: $ical_data .= 'PRODID:-//'.$homepage->title.'//ProcessWire//DE' works like a charm - saving the events in MS Outlook, mobile or google cal. so next challenge on this project is on the plan. Best regards - very busy mr-fan
    2 points
  9. Hi Tony! Welcome to the forum I think one of the fundamental things to consider with projects like these, is to actually look and analyse the existing data - the structure, the format, the quality, and any relationships there may be. It's almost going through the normalisation process but perhaps not as strict. It would be a good idea to take every column in the existing database to decide how that will be represented in the ProcessWire site. Probably, some of these will be simple translations - Varchars will become Text fields, and Ints will still be Integer fields. But what will be more important is the data in these fields - does it vary with just about every single dam? Is it a value representing Yes/No? Are there only a few values for that column that all dams can potentially use? If so, do the values all use the same spelling of words, or are some mixed case or have weird formatting or spacing issues? When you have a set list of values to choose from, this is where you can decide how to store the data in ProcessWire - Page fields, PageTables, Options field, etc. If your source data quality is good, your job will be easier. If it's not, there will be some work involved in preparing it so that it is clean to work with. You may already have a good idea of how your data looks or is structured, but I usually like to do some form of planning on paper or using a spreadsheet to map out the source data to the ProcessWire templates and fields. Doing the important work now will save you hassle later on down the line and will really help you to make the search feature more functional. As an example: In ProcessWire, I imagine there would be a template created called 'dam'. You might add the following fields to this template (just for starters): title description location (FieldtypeMapMarker) height (integer/float) length (integer/float) capacity/volume (integer/float) country (Page field/Options field?) built (date) opened (date) For each dam, a Page would exist somewhere in the page tree, using the 'dam' template. As you've already seen the Skyscraper profile, you can probably look at that for more ideas on how to structure things though
    2 points
  10. Added Macrura's Autocomplete Tags in Image Field to the drop-ins. Thanks Macrura !
    2 points
  11. I haven't spent a lot of time at tutsplus, but get the impression the article is not consistent with what you guys expect from them. Maybe they are just testing the waters to see if there's any interest before investing more time into it? But the article should not have been titled "Introduction to ProcessWire", it should have instead been "A quick look at ProcessWire from a WordPress perspective" – I think the article would have been just fine with that as the title. What I do know about tutsplus.com is that it says Envato on it – a business that largely exists because of WordPress (?). So I'm not entirely surprised by the content of the article. If the choice is them writing something or nothing, I'll take something. The article left me with these impressions: If I'm a WordPress user that doesn't know anything about code, I'm probably not going to look at PW after reading this. But if I'm a full time, or hobbyist web developer that uses WordPress, this article is probably going to make me take a closer look at PW. From that perspective, it's alright. Maybe the article is lacking relative to what it could have been, but we are still better off with this article than without it. The article had a lot more good to say about PW than it did bad. I just hope that they follow through with Tweeting it to their half a million followers, which they've not done yet–we could really benefit from that. Yes there are a lot of Tweets about the article, but looks to be mostly just low-follower bots, and we haven't seen any real increase in traffic here from that. There wasn't a lot of blatantly inaccurate stuff like in that other WordPress-centric article from a year or two ago. I've only read it once so far, but the only thing that made me cringe was the word "mature" in quote "ProcessWire, and its lack of a mature theming model...", which I think is not the right choice of words because there is no theming modal by design, and that is one of the points of ProcessWire. The correct thing to say would have been "If you want to create a website without any development, use a ready-to-go theme with WordPress. If you want to develop a website and have control over the output, use ProcessWire." Hopefully they are just testing the waters and will publish a real introduction to ProcessWire… one where we can tell they've actually downloaded and installed it, and taken the time to learn a little and develop something in it. Or what they should probably do is hire someone like @teppokoivula to write an article for them… someone that already knows ProcessWire well, and knows how to communicate that.
    2 points
  12. FieldtypeRuntimeMarkup and InputfieldRuntimeMarkup Modules Directory: http://modules.processwire.com/modules/fieldtype-runtime-markup/ GitHub: https://github.com/kongondo/FieldtypeRuntimeMarkup As of 11 May 2019 ProcessWire versions earlier than 3.x are not supported This module allows for custom markup to be dynamically (PHP) generated and output within a page's edit screen (in Admin). The value for the fieldtype is generated at runtime. No data is saved in the database. The accompanying InputfieldRuntimeMarkup is only used to render/display the markup in the page edit screen. The field's value is accessible from the ProcessWire API in the frontend like any other field, i.e. it has access to $page and $pages. The module was commissioned/sponsored by @Valan. Although there's certainly other ways to achieve what this module does, it offers a dynamic and flexible alternative to generating your own markup in a page's edit screen whilst also allowing access to that markup in the frontend. Thanks Valan! Warning/Consideration Although access to ProcessWire's Fields' admin pages is only available to Superusers, this Fieldtype will evaluate and run the custom PHP Code entered and saved in the field's settings (Details tab). Utmost care should therefore be taken in making sure your code does not perform any CRUD operations!! (unless of course that's intentional) The value for this fieldtype is generated at runtime and thus no data is stored in the database. This means that you cannot directly query a RuntimeMarkup field from $pages->find(). Usage and API Backend Enter your custom PHP snippet in the Details tab of your field (it is RECOMMENDED though that you use wireRenderFile() instead. See example below). Your code can be as simple or as complicated as you want as long as in the end you return a value that is not an array or an object or anything other than a string/integer. FieldtypeRuntimeMarkup has access to $page (the current page being edited/viewed) and $pages. A very simple example. return 'Hello'; Simple example. return $page->title; Simple example with markup. return '<h2>' . $page->title . '</h2>'; Another simple example with markup. $out = '<h1>hello '; $out .= $page->title; $out .= '</h1>'; return $out; A more advanced example. $p = $pages->get('/about-us/')->child('sort=random'); return '<p>' . $p->title . '</p>'; An even more complex example. $str =''; if($page->name == 'about-us') { $p = $page->children->last(); $str = "<h2><a href='{$p->url}'>{$p->title}</a></h2>"; } else { $str = "<h2><a href='{$page->url}'>{$page->title}</a></h2>"; } return $str; Rather than type your code directly in the Details tab of the field, it is highly recommended that you placed all your code in an external file and call that file using the core wireRenderFile() method. Taking this approach means you will be able to edit your code in your favourite text editor. It also means you will be able to type more text without having to scroll. Editing the file is also easier than editing the field. To use this approach, simply do: return wireRenderFile('name-of-file');// file will be in /site/templates/ If using ProcessWire 3.x, you will need to use namespace as follows: return ProcessWire\wireRenderFile('name-of-file'); How to access the value of RuntimeMarkup in the frontend (our field is called 'runtime_markup') Access the field on the current page (just like any other field) echo $page->runtime_markup; Access the field on another page echo $pages->get('/about-us/')->runtime_markup; Screenshots Backend Frontend
    1 point
  13. New processwire - responsive - site live on www.rugpijnweg.nl Thanks to this forum I found vxda who did all the coding while the design was done with his colleague Piotr from 7thavenue. Rugpijnweg.nl uses procache, and gets high scores on gtmetrix.com. It still needs some better way to optimize images and serve scaled images. Any feedback much appreciated, this site is meant to be fully responsive. Used Modules: - Procache (thanks Ryan) - ModulesManager (thanks soma) - ProcessJumplinks (thanks mike-rockett) - Thumbnails (thanks apeisa) - Get Video Thumbs (thanks adrian) Still some minor stuff needs done, happy to incorporate any feedback to make it better!
    1 point
  14. There is one thing that needs a bit attention when importing data. We need to check if a record was also imported by a previous run of the script, otherwise you may end up with numerous duplicates. while($row = $result->fetch_assoc()) { $title = wire("sanitizer")->text($row['title'], array("maxLength"=>128)); // fetch and sanitize the title $p = wire('pages')->get("title={$title}"); // check if it already exists if(0 < $p->id) continue; // move on to the next record if it exists $p = new Page(); $p->template = "dam"; $p->parent = "something"; $p->title = $title; // use the sanitized title $p->save(); }
    1 point
  15. Update: For the curious minds, the site is published at: http://www.ecocarb.com.br/ ( but only pt-br version for now) --- I'm creating a small project for a company owned by a cousin of mine and I'm using it to try new things, most on the front-end side but I decided to try jade with php. What I'm using: gulp to run all tasks – compile all sass and jade files and copy processwire files to the public folder bourbon + neat – nice mixins and grid system with a small footprint (project total css if less than 8kb - gzipped) jade + jade-php – I'm loving jade and with the jade-php npm package I can run ProcessWire code just fine. It's not the perfect world, sometimes I have to mix <?php ?> tags but I'm fine with it for such small project. Here's my basic-page.jade file: The rendered html: And here's the homepage so far (please ignore the translation, it is not done yet): And homepage's code: extends _main block header link(rel='stylesheet', href!='<?php echo $config->urls->templates?>css/home.css') block main-content include partials/_hero.jade .cta section h6 - echo __('O que dizem nossos clientes') include partials/_comments.jade a.button(href!="<?php echo $pages->get('/contact/')->url ?>") - echo __('Teste grátis por 30 dias') br small - echo __('Agende uma apresentação') section.desc h2 - echo $page->summary .services .line-behind-text h6.section-title - $services = $pages->get('/services/')->get("headline|title") - echo $services include partials/_cards.jade
    1 point
  16. Here's a similar gem: https://processwire.com/talk/topic/4105-module-create-a-pages-findquery-as-a-field/?p=40411
    1 point
  17. I think you can write a hook that will work both in frontend and admin. But you have to get the $page like this: $page = $event->arguments[0]; It seems like $page = $event->object; returns the actual page, which is admin with ProcessPageEdit in admin. But the first value in arguments array is the page we want to get in both cases, at least for saveReady event.
    1 point
  18. {all} is exactly what I was looking for. I must have hacked something in based on an example a while back and forgot about it. The paths are only ever one segment but they sometimes come in as /oldPath/subPath/oldFile.php or just /oldPath/subPath/ and I want both of those to just redirect to /newPath/. Thanks for this great module and the help with this .
    1 point
  19. You don't even necessarily need the csv step. You could also create a php file which connects to the existing database and then imports them to pw via the api.
    1 point
  20. Hi Tony! Create a template for dam and attach all needed fields to the template. Then export database table to CSV file and use this module to create dam pages from table rows. http://modules.processwire.com/modules/import-pages-csv/
    1 point
  21. Great find horst - I am most excited by the ability to save metadata. This has always annoyed me with PNGs in PS.
    1 point
  22. I saw it was trending on GitHub yesterday.... Nice font !
    1 point
  23. This may help — either directly, or pick it apart to do what you need. http://modules.processwire.com/modules/markup-activity-log/
    1 point
  24. I'd suggest taking a look at VersionControl. The plugin is certainly the goto reference for a "compare field-data" topic.
    1 point
  25. As I've already commented under the article: It seems like there was an internal job called "write something about processwire" and somebody decided to give it a go because there was nothing else to do and he was bored or something. All his other (wordpress) articles are packed up with images, code examples and so on. It's a shame :/
    1 point
  26. Processwire is not like "all other major open source CMS", so are you sure about that ? To attract more people it certainly does not need cranking up it's core, but instead it needs more marketing.
    1 point
  27. Now, click Add, there is a tree, we choose the wood is gone. But! I want to select multiple objects that are now seeing, their could be 5-15-20, I want to select them all until I see. Please do not hide the tree until I finish choose.
    1 point
  28. if anybody stumbles over this thread, here is the correct function (also gebeer's version has got a $text/$summary bug): function truncateText($text, $maxlength = 200) { // truncate to max length $text = substr(strip_tags($text), 0, $maxlength); // check if we've truncated to a spot that needs further truncation if(strlen(rtrim($text, ' .!?,;')) == $maxlength) { // truncate to last word $text = substr($text, 0, strrpos($text, ' ')); } return trim($text); } thank you ryan
    1 point
×
×
  • Create New...