Jump to content


- - - - -

[Modification] Document Content Variables


  • This topic is locked This topic is locked
118 replies to this topic

#91 ceaza

    Etomite Forum Newbie

  • Member
  • 27 posts

Posted 14 September 2005 - 05:47 PM

Thanks again for a great script

When I use the checkbox or select-multiple options I get "ARRAY" where the Content Variable is called.

My Code is:
Name [[WhichMenus]]
Field type: checkbox
Field Elements : {{none}}||{{Menu1}}||{{Menu2}}||{{Menu3}} (all calling chunks)

I call [*WhichMenus*]

If I just check 1 it works, but if I check more that 1 I get the error.

I use the following types in the pages with no problems:
Text, HTML, Radio

Please can you help.

ceaza

Edited by ceaza, 14 September 2005 - 05:47 PM.


#92 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 15 September 2005 - 04:11 AM

ceaza, on Sep 15 2005, 12:47 AM, said:

When I use the checkbox or select-multiple options I get "ARRAY" where the Content Variable is called.

If I just check 1 it works, but if I check more that 1 I get the error.

I'm sure there is a fix in the PHP code, but not having looked at that for nearly a year, I'm hesitant to even pull it up.

Here's a possible work around...
create three DocVar fields:
[*ShowMenu1*]
[*ShowMenu2*]
[*ShowMenu3*]

Each one can be a checkbox docvar with only one element in each. for example:
[[ShowMenu1]]
type: checkbox
element: {{Menu1}}

(the state of off or on will determine whether the element is displayed or not.)


... anyway... like I said, this could be solved with a little PHP.

you may want to check this in the root /index.php (mine it's around line 719):
//need to split array
$docvars[$docvar_row['field_name']] = explode("||", $docvar_row['field_value']);

possibly change that to avoid creation of an array type (which is what you see when the page gets rendered). Since the arrays really haven't been utilized, in your case you can just change that line to this:
//need to split array
$docvars[$docvar_row['field_name']] = str_replace ("||","", $docvar_row['field_value']);


If that doesn't work, then you might try this..
/manager/processors/save_content.processor.php

you need to find this code (it's around line 179 in my version):

Quote

    // deal with checkboxes & multiple selects elements
    $feature_insert = "";
    while (list($featureValue, $feature_item) = each ($_POST[$row['field_name']]))
    {
  $feature_insert = "$feature_insert||$feature_item";
    } // end while

    // now remove the first two characters
    $feature_insert_length = strlen($feature_insert);
    $feature_insert_length = $feature_insert_length - 2;
    $feature_insert = substr($feature_insert, 2, $feature_insert_length);
                                                            $docvars[$row['field_name']] = $feature_insert;


I think this needs to be modified to something more like this:

Quote

    // deal with checkboxes & multiple selects elements
    $feature_insert = "";
                                                                foreach($_POST[$row['field_name']] as $key => $value){
  $feature_insert .= "||" . $value;
    } // end while

    // now remove the first two characters
    $feature_insert_length = strlen($feature_insert);
    $feature_insert_length = $feature_insert_length - 2;
    $feature_insert = substr($feature_insert, 2, $feature_insert_length);
                                                            $docvars[$row['field_name']] = $feature_insert;


#93 Dean

    Loves Etomite Forums!

  • Admin
  • 4,746 posts
  • Gender:Male

Posted 15 September 2005 - 06:52 AM

I was just wondering if you apodigm, or anyone else, would wish to review this snippet / mod and see if there is any upgrading that can be done for 0.6.1 ?

#94 ceaza

    Etomite Forum Newbie

  • Member
  • 27 posts

Posted 15 September 2005 - 01:02 PM

Wow Thanks

Quote

you may want to check this in the root /index.php (mine it's around line 719):
//need to split array
$docvars[$docvar_row['field_name']] = explode("||", $docvar_row['field_value']);

possibly change that to avoid creation of an array type (which is what you see when the page gets rendered). Since the arrays really haven't been utilized, in your case you can just change that line to this:
//need to split array
$docvars[$docvar_row['field_name']] = str_replace ("||","", $docvar_row['field_value']);
Fixed the problem

I chose this route rather than seperate DocVars for each due to the fact the you have to edit and reload each page that uses the template, if you have a way around that I would appreciate it.

Quote

DEAN Wrote I was just wondering if you apodigm, or anyone else, would wish to review this snippet / mod and see if there is any upgrading that can be done for 0.6.1 ?

I really would like to help but I am not great with coding, I would highly reccomend this in you next releases.

Once again guys you for such a cool CMS and all the mods that make it the only CMS to work with.

#95 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 15 September 2005 - 02:33 PM

Dean,

I basically created this project years ago and rarely even look at it anymore. In fact I didn't know that E 0.6.1 was out until you mentioned it. :)

Ryan Thrash has a developer working on a fork of Etomite that includes a heavily modified DocVars in it. I think there are some other contributions embedded, and new features, but I haven't seen it. you can look through this forum for more information on his project.

If anyone wants to take DocVars and make it compatible with the new Etomite, I am happy to hand off. In fact the open source nature of the release means that anyone can modify DocVars. Based on the download count, it looks like several people have been using it, so there should be someone out there that has made some upgrades or changes.


Good luck.
JG

#96 wildthing

    Etomite Forum Newbie

  • Member
  • 11 posts

Posted 15 October 2005 - 11:22 AM

apodigm, on Sep 21 2004, 05:07 AM, said:

Here is something that you could do in the NewsListing snippet for example:

etomite->getDocVars($resource[$x]['id'],'extra_content');

This basically says to get the docvar called 'extra_content' related to the page numbered by $resource[$x]['id']
Good luck.

I'm trying to do this .... but when the snnipet is running Always showing word Array

Here i'm attach picture and modifed snippet code.... Can any one tell me what i'm doing wrong???? Thanks

Attached Files



#97 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 15 October 2005 - 08:23 PM

Is NewsListing calling DocVars? or vice versa.

Edited by apodigm, 15 October 2005 - 08:25 PM.


#98 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 15 October 2005 - 08:35 PM

ok... try this in your Snippet code....

replace:
$price = $etomite->getDocVars($resource[$x]['id'],'price');


with this:
$tmp = $etomite->getDocVars($resource[$x]['id'],'price');
$price = $tmp['price'];

#99 wildthing

    Etomite Forum Newbie

  • Member
  • 11 posts

Posted 17 October 2005 - 10:27 AM

apodigm, on Oct 15 2005, 11:35 PM, said:

ok... try this in your Snippet code....

replace:
$price = $etomite->getDocVars($resource[$x]['id'],'price');
with this:
$tmp = $etomite->getDocVars($resource[$x]['id'],'price');
$price = $tmp['price'];

THANKS!!!! THAT IS GREAT!!! IT WAS SO SIPLE AT ALL!!!.... I WISH YOU LUCK!!!! :D

FOR OTHER... DOC VARS I'M NEED TO DO SAME?

#100 wildthing

    Etomite Forum Newbie

  • Member
  • 11 posts

Posted 20 October 2005 - 08:51 AM

Hi!!! Again)))))) My new question is.... HOW CAN I UPLOAD documents like Word or Exel files... or in some other types.... when i'm use the file form... this form upload only images... but not the document... Anyone can tell me what changes I need to do? :huh:

#101 Dean

    Loves Etomite Forums!

  • Admin
  • 4,746 posts
  • Gender:Male

Posted 24 October 2005 - 07:32 AM

How is this related to DocVars?? (Is it? I don't know ;) )

You need to use the file upload manager within the etomite manager

Edited by Dean, 24 October 2005 - 10:01 AM.


#102 wildthing

    Etomite Forum Newbie

  • Member
  • 11 posts

Posted 24 January 2006 - 10:47 AM

I'm meen ... you have some document and you need to attach to this document some exel file.... or word file. With DocVars i could upload for each document just pictures but i'm need files to upload ... :blink: I need something like in this forum (Attachments)

#103 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,506 posts
  • Gender:Male

Posted 24 January 2006 - 02:40 PM

wildthing, on Jan 24 2006, 06:47 AM, said:

I'm meen ... you have some document  and you need to attach to this document some exel file.... or word file. With DocVars i could upload for each document just pictures but i'm need files to upload ... :blink: I need something like in this forum (Attachments)
When you say "attach" are you referring to simplay adding an attachment link into your document or are you wanting to display the contents of this attachment...??? If you are referring to the concept of storing attachments in your database, which is how I am interpreting your request, although it is possible to do this most of the development community frowns upon the storage of external content in blobs within databases due to reliability issues... Doing so would required that you, as the developer, be well versed in both PHP and MySQL because manipulating such data is not as easy as it may sound... The preferred method would be to creat an upload directory and then simply link to the external resource for downloading... Working with files stored in blobs entails use of mime types and sending mime-specific headers when extratcing them from the database for use...

#104 apodigm

    Etomite Forum Newbie

  • Member
  • 41 posts

Posted 24 January 2006 - 02:52 PM

err... I'm looking back at this code. I'm not sure the file-type docvar is working at all. Is it possible that it is storing the image directly into the database (and not really saving the file)? The code doesn't look like it is doing a file-upload and saving. Instead, it just dumps the post information directly into the database.

This might be something to fix as the code gets ported to the new etomite.

BTW... I've never successfully gotten "[DO NOT CIRCUMVENT THE WORD FILTER]" to work. However, they were working off a version of Etomite and they had a pretty strong marriage with DocVars. You may look into that code to see if they have some ideas on how to integrate in the new version of Etomite.

Good luck.

Edited by apodigm, 24 January 2006 - 03:30 PM.


#105 sipe

    Etomite Forum Newbie

  • Member
  • 13 posts

Posted 26 February 2006 - 12:10 AM

apodigm, on Sep 7 2004, 07:01 AM, said:

This was written based on the 0.6 (edit) FINAL release and I have provided my modified files if you just want to diff with your install.

apodigm, this seems exactly what I was looking for but missing in etomite. great job!

does this mod work with 0.6.1-RTM release, which I am thinking of upgrading to prior to actually taking docvars into use? can I just overwrite with your files or do I need to make all changes manually?

thanks for your help.

#106 Dean

    Loves Etomite Forums!

  • Admin
  • 4,746 posts
  • Gender:Male

Posted 26 February 2006 - 12:13 AM

Any changes made in the previous attached files (if there are any), will need to be manually re-done in any RTM code-base... do not simply use 0.6.0 files on an RTM install - It will break it!

TVars and DocVars are planned for 0.7 (hopefully)

#107 Guest_rthrash_*

  • Guests

Posted 01 March 2006 - 04:59 AM

That should be a huge boost for Etomite. Good choice!

#108 sipe

    Etomite Forum Newbie

  • Member
  • 13 posts

Posted 01 March 2006 - 06:18 PM

Dean, on Feb 26 2006, 03:13 AM, said:

Any changes made in the previous attached files (if there are any), will need to be manually re-done in any RTM code-base... do not simply use 0.6.0 files on an RTM install - It will break it!

TVars and DocVars are planned for 0.7 (hopefully)

LOL, I wasn't planning on overwriting the 0.6.1 RTM files with the DocVars files, merely enquiring what the exact changes are in each of the files packed in the zip, so those could maybe be "copied out" to the new version of etomite. :)

is there someone reading this who could help get this working for 0.6.1.? with so many happy users of DocVars out there, would anyone with the skills like to port DocVars on the latest Etomite release? I am sure the community would appreciate it and praise that someone for all its worth...I know I would, and very much so.

as for myself, since it seems that DocVars has what I really need now, I think I will take it into use on my 0.6 final rather than update to 0.6.1 RTM now and risk not being able to use it, unless there is someone who does not mind helping out with this.

#109 sipe

    Etomite Forum Newbie

  • Member
  • 13 posts

Posted 20 April 2006 - 10:11 AM

sipe, on Mar 1 2006, 10:18 PM, said:

is there someone reading this who could help get this working for 0.6.1.? with so many happy users of DocVars out there, would anyone with the skills like to port DocVars on the latest Etomite release? I am sure the community would appreciate it and praise that someone for all its worth...I know I would, and very much so.

now that the new etomite release Etomite (0.6.1 Prelude Final) is out, has anybody been able to use DocVars with it? I am tempted to upgrade to the new release, but am still hesitating, as I would really need to use DocVars with it. I am planning to mod my etomite installation with DocVars very soon, but unfortunately, I am not sure if I should upgrade to 0.6.1 first or not. can anybody please help me?

I have understood that we will need to wait until release 0.7, before etomite has this functionality as part of its core code. does anybody know whether the "mechanism" of how content will be addressed in etomite 0.7 version change from DocVars, that is do I need to rewrite all my page templates again, if I go with DocVars now?

thanks for your help!

#110 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,506 posts
  • Gender:Male

Posted 20 April 2006 - 01:53 PM

sipe, on Apr 20 2006, 07:11 AM, said:

now that the new etomite release Etomite (0.6.1 Prelude Final) is out, has anybody been able to use DocVars with it? I am tempted to upgrade to the new release, but am still hesitating, as I would really need to use DocVars with it. I am planning to mod my etomite installation with DocVars very soon, but unfortunately, I am not sure if I should upgrade to 0.6.1 first or not. can anybody please help me?

I have understood that we will need to wait until release 0.7, before etomite has this functionality as part of its core code. does anybody know whether the "mechanism" of how content will be addressed in etomite 0.7 version change from DocVars, that is do I need to rewrite all my page templates again, if I go with DocVars now?

thanks for your help!
The only change to the Etomite database for Etomite Prelude Final was the addition of a single data field in the site_content table... No major changes will be made until the next major release, Metamorphosis... :eto:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users