Jump to content

arjen

Members
  • Posts

    1,222
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by arjen

  1. Hi, I'm working on some automation of repetitive tasks. I'm creating a module which creates a couple of fields and a repeater to hold those fields. I'm running into something I don't understand. This is my code: <?php // Create an array to store the repeaterField data $fields = array(); // Create the body field $f = new Field(); $f->type = wire()->modules->get("FieldtypeText"); $f->name = "subject"; $f->save(); // Add the field to the array array_push($fields, $f->id); // Create the body field $f = new Field(); $f->type = wire()->modules->get("FieldtypeText"); $f->name = "author"; $f->save(); // Add the field to the array array_push($fields, $f->id); // Create a repeater field $f = new Field(); $f->type = wire()->modules->get("FieldtypeRepeater"); $f->name = "quotes"; $f->repeaterFields = $fields; // Save the array as repeaterFields $f->save(); So far, so good. All fields get made and are available in the CMS. However, when looking in the CMS the $fields array seems empty, because there seems to be no fields assigned (see screenshot below). However when checking directly in the API using: print_r(wire()->fields->get('repeater')->repeaterFields); It does display the original values (the id of the subject and the id of the author). When editing the repeater field through the CMS and assigning a field it overwrites the repeaterFields value. From that point on everything works as expected. There has to be a step I'm missing. Can anyone help me out? Many thanks in advance.
  2. arjen

    My new Portfolio

    Amazing photography horst! Great colour palette too. I think your portfolio page should be your homepage. It is such a nice page and I really get the feeling browsing your photo's. Minor bug: the loading image has a different background color. See attachement.
  3. Thanks soma for the info. I ran into some issues but realised the module installed itself. My new code: if ($modules->isInstalled("MarkupBox")) { echo $modules->get("MarkupBox")->render(); }
  4. It's the other way around Thanks nik!
  5. I've made a simple module called MarkupBox which is not installed in the CMS, but the files are in the module directory (/site/modules/). When I call the module from a template it returns the value. I suppose there is a way to check if a module is installed, but I can't find it in the code or in the forums. I'm looking for someting like: if ($modules->get("MarkupBox")->isInstalled()) { // Do something } Module: public function render() { $out = "Test"; return $out; } Template: $box = $modules->get("MarkupBox"); echo $box->render(); Thanks!
  6. Thanks! Will check and use github to report these kind of things.
  7. When using this setting on a Page Fieldtype... ... and displaying that Fieldtype (author) in a Fieldset (tab_attributes) ... ... the autoload won't work. It doesn't give any options. No JS or other errors in my console. When I save the Fieldtype (author) outside the Fieldset (tab_attributes) it works fine. Other options like PageListSelect or PageListSelectMultiple seem to work fine within a Fieldset. I'm running the latest dev branch. Is this is bug?
  8. The topic is over a year old, but it doesn't seem possible.
  9. Really nice UI solution when working with more than 2 languages. Most often the simplest solutions are the most difficult to think of.
  10. No offense roelof, but I think it would be wise to take a step back and do some php tutorials. You can drop the last ?>. You can't use php in php. See this example below how to fix it. Notice the {} around the variables and the single quotes in the double quotes. For an editor I'm using Sublime Text 2. Don't edit php files in a textarea please <?php if ($page->id == 1) { echo "<link type='text/css' href='{$config->urls->templates}styles/twentythings.css' rel='stylesheet' media='screen' />"; }
  11. I think you mean Template File Editor. When looking for modules make sure you look in the modules site.
  12. @Vineet Sawant, it seems to be Simple Grid. @Marty Walker, great site!
  13. arjen

    Hanna Code

    [[gallery tag=skyscrapers" sort="-created" limit="10" paginate="true]]
  14. @vayu, you might want to use strftime since that will respect your locale. So you might want to convert it. Can't really tell if that's best practice but it might work. @digitex, I made a mistake updating my code partially. Make sure you use: $t = $modules->get('MarkupTwitterFeed'); instead of: $t = new MarkupTwitterFeed; That worked for me.
  15. Try this: https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=YOURNAMEHERE Edit 1: Doesn't seem to work since the last couple of days? The finally shut it down. Edit 2: Seems Ryan updated the module. You don't seem to need a feed anymore.
  16. I only use the sass preprocessor while developing on my local machine. I deploy the generated css to the live site. I might be wrong, but this is best practice I believe. I haven't got time but you can search Google for sass workflows.
  17. Yeah, I was a little bit worried with all the Ruby stuff, but it's just to preprocess the css. You don't need it on your own webserver.
  18. What about: $i = 0; foreach ($items as $item) { $i++; if ($i == 1) { // Do stuff the first item } else { // Do stuff the other items } }
  19. I've been using Susy for some small personal projects and once you get the hang of it every other framework feels like a bloat. Their adagium is: Your markup. Your design. Our math. Sound familiair?
  20. You are saving the page? Are you getting any errors? You can enable the debug function in /site/config.php or check the /site/assets/log files.
  21. Just wanted to say: great module teppo. It seems nicely structured and documented so I've been learning some new things!
  22. Thanks for sharing, harmster!
  23. It is as simple as this: <?php /** * Page template * */ include("./head.inc"); echo $page->body; echo $page->your_field_name; echo $page->another_field_name; echo $page->third_field_name; include("./foot.inc"); But do finish to those tutorials. You easily get a grasp of all the possibilities.
  24. Welcome tv_855, you might want to checkout some tutorials first. For the fields to work on the frondend you have to include the fields in in your php files. Checkout these: Basic website Another basic planet based tutorial
  25. Just tested this on a site and it seems to works here fine. I'm running PW 2.3.0 with FormBuilder 0.2.1.
×
×
  • Create New...