Leaderboard
Popular Content
Showing content with the highest reputation on 05/24/2013 in all areas
-
Greetings Everyone, Sorry I missed this discussion until now. Yes, I am working on a ProcessWire book and companion Web site. As a technical writer/developer/designer, ProcessWire has been an inspiration on multiple fronts: creating Web sites, going deeper with design/development, and writing/documenting the system. I've been working regularly on the book project, and I have about 175 pages completed already. I'll have much more to share in the coming weeks. Stay tuned, Matthew3 points
-
And good old Soma has even a module for it: https://gist.github.com/somatonic/23119943 points
-
If I've understood right you only need to get rid of the <ul>...</ul> wrapping the initial function call and modify the if-statement inside the function just a little bit to let it proceed on the first round even if there are no records found. Like this: <?php function listProducts($productCat,$level=0) { $result = wire('db')->query("SELECT id, product, productcat FROM products WHERE productcat='$productCat' ORDER BY subcat"); if($level > 0 && $result->num_rows == 0) return; echo "<ul class='sortable'>\n"; while (list ($id, $product) = $result->fetch_row()) { echo "<li id='item_{$id}'>\n"; echo "<div class='dd-handle'>{$product}</div>\n"; listProducts($id,$level+1); echo "</li>\n"; } echo "</ul>\n"; } ?> <div> <h5>Products</h5> <?php echo listProducts(0);//call the function ?> </div> As a side note, I usually build a simple safety net when using recursive functions just to be on the safe side if (when) there's suddenly broken data in the database. Here that would mean adding one line at the beginning of the function: // ~25 levels of product categories could be considered an error, I think. // Use something big enough to allow any legitimate data but small enough to allow the server stay alive. if($limit > 25) throw new WireException("Recursion gone wild"); While it's not necessary, it's a small price to pay for peace of mind .2 points
-
Introducing MetroWire, a little theme I've been working on and using in personal projects for which was once inspired by "metro" styling and to which now I can't think of a better name for. DOWNLOAD http://modules.processwire.com/modules/metro-wire/'>Modules Directory Listing SCREENS!! Login Page Tree Templates Page Customise the colors! (for those of you familiar with less. Change the "@adminAccent" colour variable in "templates-admin/styles/less/vars.less" and compile to customise the main colour to whatever you like!) Hopefully at some point I can integrate the compiling and even give users the ability to choose their colour... fun! Hope you guys enjoy this, thanks for taking a look if you do! I also did a Tweak to the AdminBar to match my theme more closely (hopefully Apeisa doesn't mind), and did some naming changes to solve a conflict I had on a project that used Bootstrap AdminBar-TWEAK.zip1 point
-
My first idea was to directly use the webservice APIs via cronjob. But then I remembered IFTTT.com and now everytime something happens on a social network IFTTT will send an E-Mail to social@nico.is and this IMAP inbox is automatically checked and processed via cronjob so that for every email a page in my pw installation will be created and the mail will be deleted.1 point
-
Looks like it can't connect to the db anymore. What sql did you run? This doesnt look like PW is the root of the problem. Have restarted apache and mysql server?1 point
-
1 point
-
hi wishbone i don't know if this helps you but the same error is described here http://processwire.com/talk/topic/2765-problem-with-command-line-scripts/?hl=%2Bexception%3A+%2Bconnect+%2Berror+%2B20021 point
-
Pw is sanitizing the filename, meaning it replaces any problematic characters such as Umlauts (ä,ö,ü) and spaces with '_'. See Pagefiles::cleanBasename() // ... $basename = preg_replace('/[^-_.a-zA-Z0-9]/', '_', $basename); $ext = preg_replace('/[^a-z0-9.]/', '_', $ext); // ...1 point
-
Hi thijs, It's in the dev branch only. So you have two (there are more of course, it's Pw!) solutions: Use the dev version of Pw and get the page that rendered the template with $options['pageStack']. The method ryan mentioned in the post at the end. Before rendering the home template: $home->caller = $page; Then in your home template, you can access the caller page with $page->caller;1 point
-
1 point
-
1 point
-
I'm reporting back here, although I'm not entirely sure what happened. In addition to not being able to access /processwire, I was also experiencing some odd DB behavior. so, via command line ran: mysqlcheck --repair; While everything came back as OK — when it was done— all my issues cleared up. I had also re-uploaded the /site and /wire directories, so that may have been what fixed it as well. All I know is that something was seriously borked, just not sure what. Anyhow, back to work.1 point
-
yeah thumbs down for Drupal & Joomla 6 (2013) Movie saw it last week, in this 5th sequel, Drupal meets Joomla, Drupal loses Joomla, Drupal finds Joomla again, marries Joomla... Drupal & Joomla VII (2014) (sci-fi) Drupal meets Joomla. Drupal loses Joomla. Drupal builds Joomla. Drupal, Wordpress & Joomla (2015) Drupal meets Wordpress. Drupal loses Wordpress. Drupal finds Joomla. Chase takes forty minutes, dialogue six, and gun shots fill in void. Drupal & Processwire (2016) Drupal meets Processwire, they belong to different gangs, war breaks out.1 point
-
I found creative way to fix the problem! HTML inspection in Chrome over empty raws has shown that there are empty <a> tages which I manually filled with qwerty text. After that page became accessible with all edit/move/delete links near it. )))1 point
-
Hi gRegor, first of all welcome! Before going into your code, are you aware that there is an excellent and simple module for this already? You can choose maxdepth as well as your own custom selectors. Here is the relevant thread http://processwire.com/talk/topic/1036-markupsimplenavigation/ You may well be aware of this already and want to code your own but just in case1 point
-
Being able to add a custom tag in tinyMCE to create a pagebreak would be ideal for a project I'm working on. I tried out Ryan's code here, which works for splitting things up (although I discovered that I need to add a #pagebreak# at the beginning of the first page for it to work right or else it will start at page 2). The problem is when it comes time to add navigation, since the resulting array is not a WireArray and thus I can't use get("limit=1") on it and then call renderPager() on the result. I tried creating a new WireArray object from scratch and adding the contents of $pageBreaks to that, but it won't accept them as valid input. I feel like I'm probably barking up the wrong tree with this... EDIT: Ok, so it looks like I just need to build my own navigation from scratch. I can see why a repeater is probably the better way to go here. EDIT 2: I have it working now. The reason I had to add a #pagebreak# to the top of the page with the original code is that the page numbers start at 1 while the array was 0-based so there was a mismatch. If anyone else wants to do something similar, here's the final code from my template with my custom navigation: <? $pageBreaks = explode('<p>#pagebreak#</p>', $page->body); $numPages = count($pageBreaks); $currentPage = $input->pageNum; if(array_key_exists($currentPage-1, $pageBreaks)) { $body = $pageBreaks[$currentPage-1]; } else { throw new Wire404Exception(); } ?> <?= $body ?> <? if($numPages > 1) { ?> <div id="pagination-center-1"> <div id="pagination-center-2"> <ul id="pagination"> <li <? if($currentPage > 1) { echo 'class="previous"'; } else { echo 'class="previous-off"'; } ?>> <? if($currentPage > 1) { echo '<a href="page'. ($currentPage - 1) .'">« Previous</a>'; } else { echo '« Previous'; } ?> </li> <? for($i=1; $i <= $numPages; $i++) { ?> <li> <a href="page<?= $i ?>" <? if ($currentPage == $i) { echo 'class="active"'; } ?>><?= $i ?></a> </li> <? } ?> <li <? if($currentPage < $numPages) { echo 'class="next"'; } else { echo 'class="next-off"'; } ?>> <? if($currentPage < $numPages) { echo '<a href="page'. ($currentPage + 1) .'">Next »</a>'; } else { echo 'Next »'; } ?> </li> </ul> </div> </div> <? } ?> And for complete "plug-and-play", here's my CSS for the pagination: ul#pagination { list-style:none; position:relative; float:left; left:-50%; margin-top:10px; } #pagination li { display:block; float:left; border:0; font-size:11px; margin-right:2px; } #pagination a { border:solid 1px #9aafe5; margin-right:2px; display:block; float:left; } #pagination .previous-off, #pagination .next-off { border:solid 1px #DEDEDE; color:#888888; font-weight:bold; margin-right:2px; padding:3px 4px; } #pagination .next a, #pagination .previous a { font-weight:bold; } #pagination .active { background:#2e6ab1; color:#FFFFFF; font-weight:bold; padding:4px 6px; } #pagination a:link, #pagination a:visited { color:#0e509e; padding:3px 6px; text-decoration:none; } #pagination a:hover{ border:solid 1px #0e509e; } #pagination-center-1 { overflow:hidden; z-index:-1; height:45px; } #pagination-center-2 { position:relative; float:left; left:50%; } #pagination a.active { color:#FFFFFF; EDIT 3: I recently revisited this on one of my new ProcessWire sites where I was using the built in PW pagination as well as this custom TinyMCE pagination system, and I wanted to get the pagination to look exactly like the standard PW pagination instead of what I posted above, which is a bit different. If you want it to use the exact same look & CSS classes as ProcessWire, here is the code: <? if($numPages > 1) { ?> <ul class="MarkupPagerNav"> <? if($currentPage > 1) { ?> <li class="MarkupPagerNavPrevious"> <a href="page<?= $currentPage - 1 ?>">Prev</a> </li> <? } ?> <? for($i=1; $i <= $numPages; $i++) { ?> <li <? if ($currentPage == $i) { echo 'class="MarkupPagerNavOn"'; } ?>><a href="page<?= $i ?>"><?= $i ?></a></li> <? } ?> <? if($currentPage < $numPages) { ?> <li class="MarkupPagerNavNext"> <a href="page<?= $currentPage + 1 ?>">Next</a> </li> <? } ?> </ul> <? } ?> And the default PW pagination CSS by Ryan: .MarkupPagerNav { margin: 1em 0; font-family: Arial, sans-serif; float: right; } .MarkupPagerNav li { float: left; list-style: none; margin: 0; } .MarkupPagerNav li a, .MarkupPagerNav li.MarkupPagerNavSeparator { display: block; float: left; padding: 2px 9px; color: #fff; background: #2f4248; margin-left: 3px; font-size: 10px; font-weight: bold; text-transform: uppercase; } .MarkupPagerNav li.MarkupPagerNavOn a, .MarkupPagerNav li a:hover { color: #fff; background: #db1174; text-decoration: none; } .MarkupPagerNav li.MarkupPagerNavSeparator { display: inline; color: #777; background: #d2e4ea; padding-left: 3px; padding-right: 3px; }1 point
-
I have nice module to share to make users list more manageable with 1000+ users. I don't remember if I have released it yet though (and on mobile now).1 point
-
You most likely ran out of memory. MAMP and other *AMP installs often come configured with 32 MB memory limit for PHP, which isn't enough to upload largish files via ajax. View your phpinfo to see where your php.ini file is located. Edit it, and change memory_limit to 256M. Also in php.ini, update post_max_size to be the same or larger. Restart server and double check that the changes took effect by finding memory_limit in your phpinfo output.1 point