We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

LG Data Matrix - New Multi-Text like custom field extension.

Development and Programming

Jamie Pittock's avatar
Jamie Pittock
108 posts
about 17 years ago
Jamie Pittock's avatar Jamie Pittock

Another error…

The data matrix field isn’t included in the SAEF but when viewing an entry in the control panel submitted from the SAEF I get the following errors…

Warning: array_keys() [function.array-keys]: The first argument should be an array in /path/to/cp/extensions/ext.lg_data_matrix_ext.php on line 1038

Warning: Invalid argument supplied for foreach() in /path/to/cp/extensions/ext.lg_data_matrix_ext.php on line 1039
       
Jamie Pittock's avatar
Jamie Pittock
108 posts
about 17 years ago
Jamie Pittock's avatar Jamie Pittock

Sorry I should have maybe dug a little deeper first. Sending the columns as hidden inputs seems to have sorted it. Might be nice to do it without though.

<input value="" name="field_id_115[cf_news_external_url][]" type="hidden" />
<input value="" name="field_id_115[cf_news_external_label][]" type="hidden" />

The no parsing in the template is still annoying me though if anyone has any ideas.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham
Leevi, I’m trying this out but in my template the tags aren’t being parsed. Using the code…
{lg_data_matrix limit="10"}
{rows}
<li><a href="http://{cf_news_links_url}">{cf_news_links_label}</a></li>
{/rows}
{/lg_data_matrix}
I get {lg_data_matrix limit="10"}{rows}{cf_news_links_label} {/rows}{/lg_data_matrix} * {cf_news_links_label} is linked.

Hey Smallbeer,

{lg_data_matrix … should be your custom filed short name. By the looks of things it could be {cf_news_links}?

In the example my custom field was {lg_data_matrix}

Cheers

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham
Another error… The data matrix field isn’t included in the SAEF but when viewing an entry in the control panel submitted from the SAEF I get the following errors…
Warning: array_keys() [function.array-keys]: The first argument should be an array in /path/to/cp/extensions/ext.lg_data_matrix_ext.php on line 1038

Warning: Invalid argument supplied for foreach() in /path/to/cp/extensions/ext.lg_data_matrix_ext.php on line 1039

Feel like a bit of hacking? 😊

Try change lines 1030 - 1044 (or there abouts) to:

// new entry
            if(($cols = unserialize($field_data)) === FALSE || empty($field_data) === TRUE)
            {
                $r .= $this->_build_row($this->conf['cols']);
            }
            // edit
            else
            {
                $col_short_names = array_keys($cols);
                foreach ($cols[$col_short_names[0]] as $rows)
                {
                    $r .= $this->_build_row($this->conf['cols'], $cols);
                }
            }
            $r = "<div class='lg_multi-text-field'>".$r."</div> <a class='add-row'>Add row</a>";

This should check if there is actually data to unserialise and build the rows. If there is no record the extension is still storing an empty array. I’ll try and update it so that if there is an empty row it doesn’t get stored.

Cheers

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham

I have included the fix above into the 0.0.3 release so theres no need to hack the code now. Just grab the latest.

       
Bruce2005's avatar
Bruce2005
536 posts
about 17 years ago
Bruce2005's avatar Bruce2005

Attached a screenshot when adding a row…

This is awesome, nice work!

       
Jamie Pittock's avatar
Jamie Pittock
108 posts
about 17 years ago
Jamie Pittock's avatar Jamie Pittock
Leevi, I’m trying this out but in my template the tags aren’t being parsed. Using the code…
{lg_data_matrix limit="10"}
{rows}
<li><a href="http://{cf_news_links_url}">{cf_news_links_label}</a></li>
{/rows}
{/lg_data_matrix}
I get {lg_data_matrix limit="10"}{rows}{cf_news_links_label} {/rows}{/lg_data_matrix} * {cf_news_links_label} is linked.
Hey Smallbeer, {lg_data_matrix … should be your custom filed short name. By the looks of things it could be {cf_news_links}? In the example my custom field was {lg_data_matrix} Cheers

Thanks mate, I am an idiot.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham

No worries… can you confirm that adding rows in the cp is working fine for you?

       
smartpill's avatar
smartpill
456 posts
about 17 years ago
smartpill's avatar smartpill

This is awesome! I actually wished for something like this in the feature request forum.

I did run into a few small issues. I can’t seem to get an “if” statement to work on the inner fields. Is this doable? Also, if there was some way to get this to work in an SAEF (by the way, your file upload for SAEF works like a charm), I’ll roll around on the floor like a happy dog.

Here’s an example of what I was trying to do for the output page.

Example:

{loc}
<dl>
<dt>{loc_name}</dt>
<dd>{loc_street}</dd>
{if loc_tel}<dd>phone: {loc_tel}</dd>{/if}
</dl>
{/loc}

When I did try it on an SAEF (along with the file upload extension) the file uploaded to the wrong field. The actual field currently has Mark Huot’s file for the custom field type, so maybe that’s causing a problem there? EDIT: The file upload extension works fine. I had the wrong ID. Ewps. The other issue is that the Data Matrix Fields don’t get filled.

Those I added like this:

<input value="" name="field_id_6[loc_name][]" type="text" />
<label>Event Location Street Address</label>
<input value="" name="field_id_6[loc_street][]" type="text" />
       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham

Yeah there is still a bit of work to do on the finer points such as conditional comments. Hopefully I’ll have a bit of time to look over it on the weekend.

Regarding using this in SAEF, I never really considered it for that but I’ll look into that as well.

       
Jamie Pittock's avatar
Jamie Pittock
108 posts
about 17 years ago
Jamie Pittock's avatar Jamie Pittock
No worries… can you confirm that adding rows in the cp is working fine for you?

Yep it’s all gravy.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham

Just updated to 0.0.4… it fixes a couple of bugs and inforces the required option for the custom field.

Unfortunatley this update may break existing data because it is stored differently in the database… I guess thats why we are only at 0.0.4 😊

Cheers

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham

Just updated to 0.0.5 which fixes a couple of bugs that popped up in the 0.0.4 release. Thanks to Luke for picking these up.

       
Adrienne L. Travis's avatar
Adrienne L. Travis
213 posts
about 17 years ago
Adrienne L. Travis's avatar Adrienne L. Travis

I still have issues with MarkItUp in weblogs where there is also a DataMatrix field. It works fine in any weblog where there’s NOT one, but it fails to display if there is one. I can PM you if you’d like to take a look. I’m now updated to v.0.0.5 and still have the issue.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
about 17 years ago
Leevi Graham's avatar Leevi Graham

Fire a PM my way… I’ll take a look in the morning. 😊

       
1 2 3 4 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.