Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/19/2012 in all areas

  1. Regarding to the post onjegolders made, I made a little form to create new pages. I think from this point it would not be hard to add more functionality. <?php /** * Page template * */ include("./head.inc"); echo $page->body; $success_message = "<h3 class='success'>Saved</h3>"; $success = false; // we assume it and set to true if form sent $error = false; // set and sanitize our form field values $form = array( 'name' => $sanitizer->text($input->post->name), 'title' => $sanitizer->text($input->post->title) ); $required_fields = array( 'name' => $input->post->name, 'title' => $input->post->title ); // check if the form was submitted if($input->post->submit) { // determine if any fields were ommitted or didn't validate foreach($required_fields as $key => $value) { if( trim($value) == '' ) { $error_message = "<h3 class='error'>Please check that you have completed all the required fields.</h3>"; $error = true; } } // if no errors, create a new page if(!$error) { $p = new Page(); // create new page object $p->template = 'basic-page'; // set template $p->parent = wire('pages')->get('/about/'); // set the parent $p->name = $input->post->name; // give it a name used in the url for the page $p->title = $input->post->title; // set page title (not neccessary but recommended) $p->save(); //create the page // populate fields $p->summary = 'Variable here'; // Populate a field $p->body = 'Variable here'; //Populate a field $p->save(); //save the populated fields echo $success_message; echo 'id: '.$p->id.'<br/>'; echo 'path: '.$p->path; } } ?> <?php if(!$success) { ?> <?php if($error) { echo $error_message; } ?> <form action="./" method="post" id="submitform"> <fieldset> <label for="name">Name *</label> <input type="text" name="name" value="" value="<?php echo $user->name; ?>" autofocus required /> <label for="email">Title *</label> <input type="text" name="title" value="" required /> <input type="submit" name="submit" value="submit" /> </fieldset> </form> <?php } else { echo $success_message; // testing echo 'id: '.$p->id.'<br/>'; echo 'path: '.$p->path; ?> <?php } ?> <?php include("./foot.inc"); ?> works on my localhost.
    3 points
  2. If it's a single page field $post->category->title If multiple, it's an array of pages $post->category->first()->title If think your example would have to be $pages->get($post->category->id)->title But no need to get the page as you already got it (or the bunch of them as pagearray)
    2 points
  3. Hiya Barry, without going into much detail as am a bit rushed at the moment, with PW you can easily use the API to add/edit/delete pages. This case sounds like it would be no different. Create page: $p = new Page(); $p->template = 'myTemplate'; $p->name = 'page_name'; $p->parent = '/parent_page/'; $p->of(false); $p>title = 'My New Page'; $p->save(); Edit page $p = $pages->get("/about/"); $p->of(false); // turn off output formatting $p->title = "New Title"; $p->my_field = "My Value"; $p->save(); Delete page $p = $pages->get("/about/"); $p->delete(); If you want to let members edit this, just place it all in an if statement and set up a form to input the data. Then make sure you sanitize the data before adding it to the new page. This can apply to users as well as normal pages. It is all editable via the API. There's tons of topics out there already on the forum but check out the API http://processwire.com/api/ And Soma's cheatsheet http://processwire.com/api/cheatsheet/
    2 points
  4. Hi Harm, try to develop the habit of always putting the constant first in statements like this... if('inactive' == $u->user_status) ... Then if you miss out an '=' sign PHP will shout at you about it.
    2 points
  5. Markup Simple Navigation Module While there was a lot of people asking how to make navigation, and there were many examples around already (apeisa, ryan...) I took the chance to sit down 2-3 hours to make a simple navigation module. It has even some options you can control some aspects of the output. Installation: 1. Put this module's folder "MarkupSimpleNavigation" into your /site/modules folder. 2. Go to your module Install page and click "Check for new modules". It will appear under the section Markup. Click "install" button. Done. Technically you don't even need to install it, after the first load call ( $modules->get("MarkupSimpleNavigation") ) it will install automaticly on first request if it isn't already. But it feels better. However, it will not be "autoloaded" by Processwire unless you load it in one of your php templates. Documentation: https://github.com/somatonic/MarkupSimpleNavigation/blob/master/README.md Modules Repository processwire.com mods.pw/u Download on github https://github.com/somatonic/MarkupSimpleNavigation Advanced example with hooks creating a Bootstrap 2.3.2 Multilevel Navbar https://gist.github.com/somatonic/6258081 I use hooks to manipulate certain attributes and classes to li's and anchors. If you understand the concept you can do a lot with this Module.
    1 point
  6. Hey there, I want to start a new project and at the moment I think about which CMS i will use. With Drupal I will be able to build this. But I will use ProcessWire and I think about how it can work. Some requirements: - user: registration (perhaps with a confirmation mail) - user: login (not in admin menu) - user: forget password - user: profile - user should be able to create new content, but not with the backend view. He should be able to create new content after he logged in… - overview of all generated content from the users - comment on a created page - user should be able to delete his own pages - perhaps a notification system These are some important requirements. Do you think it is possible with ProcessWire and can you name some modules which can help? z.
    1 point
  7. I still use Fancybox 1.3.4 in my projects, Fancybox 2.x is nice but it's cluttered with options and weight. So, I've made a modified version of Fancybox 1.3.4, stripped down IE6,7 support, removed bunch of sliced graphics that make shadows and such and made it use CSS3 instead. It's a 1:1 copy except title position outside that resembles one used in Fancybox 2. I've also used next, previous and close buttons from Fancybox (like the bigger buttons more ) It's only 25kb in weight, and consists of 4 files only. You can try it by downloading from the link below. Ryan, maybe you could substitute your version from the core with this one? You can see the demo here. ----------------------------------------------------------------------------------------------------------------------------- EDIT: It's done (see the post below) Download: https://github.com/nvidoni/fancybox
    1 point
  8. Just a couple of things about PW 1. On this website when on the modules tab, the demo link disappears from the main navigation. 2. When starting a new topic in the forum, the video link in the main navigation is behind the forum link, this is in Chrome, but strangely it doesn't happen every time. 3. I would like to see a tutorial similar to the one here: http://www.couchcms.com/docs/tutorials/. A full site build, from installation to the finished product. It would be great if you could download as a PDF to print, I think I saw somewhere a module? that could convert webpages to PDF. I initially dismissed PW as a CMF/CMS because it wasn't immediately obvious how awesome it is. This tutorial http://processwire.com/talk/topic/693-small-project-walkthrough/ helped a lot. 4. Loving PW and the community!
    1 point
  9. I am too late to see what your page looked before, but now you are including 2 different versions of jquery: line 18: <script type="text/javascript" src="/~racc/site/templates/scripts/jquery-1.4.2.min.js"></script> line 23: <script src="http://code.jquery.com/jquery-latest.js"></script>
    1 point
  10. No there's nothing special about jQuery in PW. You do the output and include your script. PW does nothing. You have to debug it on yourself. Usually you include first the css then the scripts. First jquery core then fancybox js. I've tested it in the console and fancybox script was present and I could call it in console. So either it's a conflict with fancybox and your jquery version or you did something wrong with your code. I remember when clicking an thumbnail it showed an error related to fancybox and jquery for a split second. But now the website has changed.
    1 point
  11. You linked to jQuery?
    1 point
  12. 1. This will be fixed when we get the new site design released (preview: www.processwire.net) 2. Same thing as above. 3. True. It would be great to have simple tutorial, which takes static site design and brings it to live. PW is very straightforward to use in that case. 4. We all do!
    1 point
  13. You code is now <script type="text/javascript"> $(document).ready(function() { $('fancybox').fancybox({ openEffect : 'none', closeEffect : 'none' }); }); </script> But it should be $('.fancybox').fancybox(...
    1 point
  14. Hi MatthewSchenker, I just had a quick look over your code and website. There didn't show up any Js errors. But in the template code, you are also looping the Javascript code, so this is printed out with every image. Remove it from the loop and insert this JS-Code in the head or before the </body> tag: <script type="text/javascript"> $(document).ready(function() { $(".fancybox").fancybox({ openEffect : 'none', closeEffect : 'none' }); }); </script> </body> </html> Does this solve your issue?
    1 point
  15. Hmm do you get any error messages in your Javascript Console in Chrome? I'm also on Mac and it seems to work fine here with chrome. Try: Clear the browsers cache Clear the cache from the statistics generated with MarkupCache => Go to the module options and for example change the default date range and save, this should also clear the MarkupCache behind. Does it work with other browsers? Btw I just noticed that Chrome does not support APNG, so I will change the loading animation to a gif..
    1 point
  16. This module adds basic capability to restrict page rendering to selected number of IP addresses. Note: this is only meant to be used as an additional security measure in addition to typical username/password authentication or something similar, not on it's own! Currently individual IPs (127.0.0.1), IP ranges (127.0.0.1-127.0.0.255) and CIDR format (127.0.0.0/24) are supported. You can also decide whether restrictions should apply to a) admin area and b) authenticated users. By combining these two options you could create a site with public access restricted to selected IPs while still allowing users outside those addresses to have full access after authenticating. Better description can be found from README. And once again: all comments, bug reports, feature suggestions etc. are more than welcome! So far everything seems to work as planned, but I haven't had the chance to test this nearly as thoroughly as I'd like (that's also why this little cutie is flagged "Beta" in the modules directory..) https://github.com/t...erIPRestriction http://modules.proce...-iprestriction/ How to install Copy PageRenderIPRestriction folder to your /site/modules/, go to Admin > Modules, hit "Check for new modules" and install Page Render IP Restriction. That's it. How to use Default out-of-the-box settings don't introduce any restrictions. You can edit module settings (Admin > Modules > Page Render IP Restriction) to include those IPs you wish to allow access to your site for. Once you've filled in at least one IP address and saved module settings restriction will be immediately effective. Please note that if you fill in at least one IP address and check both "Restrict admin access" and "Restrict access for authenticated users" you will no longer be able to reach Admin without valid IP. Make sure that you've tested everything properly before turning those options on (and avoid turning them on at all unless you're 100% sure that you know what you're doing)
    1 point
  17. Thanks for the nice feedback. Good suggestion. It's pretty readable here, but tried it on my wife's computer and it was a different case. I'll try changing this to Arial or something. Sort of. I evaluated the information architecture and researched other school sites and came to the conclusion that what they had on their previous site was quite nice in terms of organization. The problem was that it was navigationally bad, which made it hard to wade through. The old site had a design problem, not an architecture one. On the new site the information architecture (and even the exact URLs) are consistent with the previous site for the most part. But the new site makes the information a lot more accessible.
    1 point
  18. That's kind of you to say. But the truth is ProcessWire makes me more productive. If I have to code something outside of ProcessWire, it takes a long time and I'm not that productive.
    1 point
  19. Hello. Just noticed that the repeatable header bar text is near invisible. Lovely theme though.
    1 point
  20. you.try this <?php foreach ($blocks as $index => $block): ?> <?= $block->set('pagamos', $page)->render(); ?> <?php endforeach; ?> menu-black tamplate: <ul class="menu-block-links"> <?php foreach ($page->pages as $item): ?> <li<?= $page->pagamos->id === $item->id ? ' class="active"' : '' ?>><a href="<?= $item->url ?>"><?= $item->title ?></a></li> <?php endforeach; ?> </ul>
    1 point
×
×
  • Create New...