arjen
Members-
Posts
1,222 -
Joined
-
Last visited
-
Days Won
8
Everything posted by arjen
-
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.
-
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.
-
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(); }
-
It's the other way around Thanks nik!
-
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!
-
Fieldtype Page with PageAutocomplete in Fieldset seems broken
arjen replied to arjen's topic in General Support
Thanks! Will check and use github to report these kind of things. -
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?
-
Can you have a repeater field within a repeater?
arjen replied to Brian Larson's topic in General Support
The topic is over a year old, but it doesn't seem possible. -
Really nice UI solution when working with more than 2 languages. Most often the simplest solutions are the most difficult to think of.
-
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' />"; }
-
I think you mean Template File Editor. When looking for modules make sure you look in the modules site.
-
@Vineet Sawant, it seems to be Simple Grid. @Marty Walker, great site!
-
[[gallery tag=skyscrapers" sort="-created" limit="10" paginate="true]]
-
@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.
-
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.
-
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.
-
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.
-
What about: $i = 0; foreach ($items as $item) { $i++; if ($i == 1) { // Do stuff the first item } else { // Do stuff the other items } }
-
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?
-
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.
-
Just wanted to say: great module teppo. It seems nicely structured and documented so I've been learning some new things!
-
Thanks for sharing, harmster!
-
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.
-
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
-
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.