Jump to content

Leaderboard

Popular Content

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

  1. Have you made your date field "autojoin"? Without setting it you cant sort by the field. On a side note, formatted dates can be sorted using "Y-m-d". For example in a sortable table.
    1 point
  2. You get very nice solution already using auto complete page field and using this feature:
    1 point
  3. Yes please. Were you also working on a front-end form for users to update their profiles? Or did I dream it? Cheers Marty
    1 point
  4. Personally, I think I prefer to use PW's API as far as possible (which seems to be pretty far). The reason is simple: As soon as I'd need extra PHP code beyond the very basic stuff needed with PW's API, I'd be lost. For me, PW's API really does work like jQuery in the ssense that it gives me an easy-to-use "layer" and spares me having to really use the language "below". Also, I think it's confusing to still think in the terminology of any other CMS. I really don't know MODx that well, so I'm perfectly happy to "think in PW terms".
    1 point
  5. It's here http://processwire.c...tsfiles-folder/
    1 point
  6. With huge amount of pages you could run scalability issues on some file systems (due the fact that PW automatically creates a folder for each page). Though this has been discussed and fix is coming at some point (can't find the topic now).
    1 point
  7. Nice work Neil! I really like the way your category tree works and I love that you put together cheat sheets. Not every site functions well with a standard blog format, and your site is a great example. I did find a few pages a little difficult to read due to the text wrapping around the category tree as seen on the following page. http://www.neilpahl.com/logs/hard-disk-management/raid/raid1-with-lvm-on-ubuntu-server/ Looking forward to the pw logs
    1 point
  8. Hi Ryan, Not that I can see, the only thing i did, was adding 2 templates, it has to be in one of these templates then I guess. - one template is a private login template: <?php if($input->post->login_submit) { // process submitted login form $name = $sanitizer->username($input->post->lblUsername); $pass = $input->post->lblPassword; if($session->login($name, $pass)) $session->redirect("./"); else echo '<p class="ui-state-error-text">Login failed, please try again.</p>'; } if($user->isLoggedin() && $user->hasRole("distributors")) { $categories = $pages->get("/private/")->children(); if (count($categories)>0) { ?> <ul class="tabs"> <?php foreach($categories as $category) { echo "<li><a href='#{$category->id}'>{$category->title}</a></li>"; } ?> <li><a href='#upload32654981'>Upload new file</a></li> </ul> <div class="tab_container"> <?php foreach($categories as $category) { $product_arr = array(); echo "<div id='{$category->id}' class='tab_content'>"; $children = $category->children(); if (count($children)>0) { foreach($children as $products) { foreach($products->related_products as $product) { $product_arr[] = $product->title; } } ?> <?php $product_arr = array_unique($product_arr); foreach ($product_arr as $value) { echo "<h2 class='acc_trigger'><a href='#'>&#187; $value</a></h2>"; ?> <div class="acc_container"> <div class="block"> <?php foreach($children as $child) { $productchild_arr = array(); foreach($child->related_products as $productchild) { $productchild_arr[] = $productchild->title; } if (in_array($value, $productchild_arr)) { if ($child->template == 'client_images') { foreach($child->client_images as $image) { $thumb = $image->height(200); echo "<a href='{$image->url}' target='_blank'><img src='{$thumb->url}' alt='{$thumb->description}' title='{$thumb->description}' width='{$thumb->width()}' height='{$thumb->height()}' /></a>"; } } else { ?> <table> <?php foreach($child->client_documents as $doc) { ?> <tr> <td><a href='<?=$doc->url?>' target='_blank'><img src='<?php echo $config->urls->templates?>img/<?=$doc->ext?>_icon.png' alt='<?=$doc->get('description|name')?>' title='<?=$doc->get('description|name')?>' width='50' height='50'/></a></td> <td><?=$doc->name?><br/><?=$doc->description?></td> <td><?=strtoupper($doc->filesizeStr)?></td> </tr> <?php } ?> </table> <?php } } } ?> </div> </div> <?php } } echo "</div>"; } ?> <div id='upload32654981' class='tab_content'> <?php $fileextensions = $page->fields->get("client_upload")->extensions; if($input->post->upload_submit) { $uploadtab = TRUE; $page->setOutputFormatting(false); // instantiate the class and give it the name of the HTML field $u = new WireUpload('lblUpload'); $u->setMaxFiles(1); $u->setOverwrite(false); $u->setDestinationPath($page->client_upload->path); $valid_ext = explode(" ", $fileextensions); $u->setValidExtensions($valid_ext); // execute() returns an array, so we'll foreach() it even though only 1 file $exec_arr = $u->execute(); if(empty($exec_arr) || !count($exec_arr)) { if(empty($notices) || !count($notices)) { echo "<p class='ui-state-error-text'>Error: Choose a file to upload!</p>"; } else { foreach($notices as $notice) { if($notice instanceof NoticeError) { echo "<p class='ui-state-error-text'>Error: {$notice->text}</p>"; } } } } else { foreach($exec_arr as $filename) $page->client_upload->add($filename); $lastfile = $page->client_upload->last(); $lastfile->description = implode(",", $input->post->lblProducts); $page->save(); echo "<p>You file has been uploaded successfully!</p>"; } } else { $uploadtab = FALSE; ?> <form action='./' method='post' class="upload_form" enctype="multipart/form-data"> <ul class='Inputfields'> <li class='InputfieldText Inputfield_lblUpload ui-widget' id='wrap_Inputfield_lblUpload'> <div class='ui-widget-content'> <p class="description InputfieldFileValidExtensions"><?php echo $fileextensions; ?></p> <p><input id="Inputfield_lblUpload" class="required InputfieldMaxWidth" name="lblUpload" type="file" maxlength="255" /></p> </div> </li> <li class='InputfieldText Inputfield_lblProducts ui-widget' id='wrap_Inputfield_lblProducts'> <div class='ui-widget-content'> <p> <?php echo '<select id="Inputfield_lblProducts" name="lblProducts[]" multiple="multiple">'; echo "<option value='no product selected'>Select your product</option>"; $products = $pages->get("/products/")->children(); foreach($products as $product) { echo "<option value='{$product->title}'>{$product->title}</option>"; if ($product->numChildren && $product->rootParent->path == '/products/') { foreach($product->children as $subsubchild){ echo "<option value='{$subsubchild->title}'>{$subsubchild->title}</option>"; } } } echo "</select> "; ?> </p> </div> </li> <li class='InputfieldSubmit Inputfield_upload ui-widget' id='wrap_Inputfield_upload'> <div class='ui-widget-content'> <button id="Inputfield_upload" class="ui-button ui-widget ui-state-default ui-corner-all" name="upload_submit" value="Upload" type="submit"><span class='ui-button-text'>Send</span></button> </div> </li> </ul> </form> <?php } ?> </div> </div> <?php } } else { ?> <form action='./' method='post' class="login_form"> <ul class='Inputfields'> <li class='InputfieldText Inputfield_lblUsername ui-widget' id='wrap_Inputfield_lblUsername'> <label class='ui-widget-header' for='Inputfield_lblUsername'>Username</label> <div class='ui-widget-content'> <p><input id="Inputfield_lblUsername" class="required InputfieldMaxWidth" name="lblUsername" type="text" maxlength="255" /></p> </div> </li> <li class='InputfieldText Inputfield_lblPassword ui-widget' id='wrap_Inputfield_lblPassword'> <label class='ui-widget-header' for='Inputfield_lblPassword'>Password</label> <div class='ui-widget-content'> <p><input id="Inputfield_lblPassword" class="required InputfieldMaxWidth" name="lblPassword" type="password" maxlength="255" /></p> </div> </li> <li class='InputfieldSubmit Inputfield_login ui-widget' id='wrap_Inputfield_login'> <label class='ui-widget-header' for='Inputfield_login'>Login</label> <div class='ui-widget-content'> <button id="Inputfield_login" class="ui-button ui-widget ui-state-default ui-corner-all" name="login_submit" value="Login" type="submit"><span class='ui-button-text'>Login</span></button> </div> </li> </ul> </form> <?php } ?> - the other one is a logout template which does a simple 301 redirect: if($user->isLoggedin()) $session->logout(); if ($page->redirect_page) $session->redirect($page->redirect_page->url); I also created a new role, added a user.
    1 point
×
×
  • Create New...