ExData Module v2.8.0 - Tables, Lists and more…

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Marcel
Posts: 80
Joined: Sat 8. Jan 2005, 13:07

Post by Marcel »

I installed exdata_mod_261for126 for phpwcms 1.2.6 and checked every single line of the installation instructions again. Then I tried to start installation manually and got this error

Code: Select all

Warning: main(PHPWCMS_ROOT/include/inc_module/mod_exdata/inc_lib/main.config.php) [function.main]: failed to open stream: No such file or directory in /var/www/vhosts/xxxxx.xx/httpdocs/signale/include/inc_module/mod_exdata/install/config_v26_new.php on line 2
and

Code: Select all

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /var/www/vhosts/xxxxx.xx/httpdocs/signale/include/inc_module/mod_exdata/install/install_v26.php on line 6
Error creating the entries table: Access denied for user 'wwwrun'@'localhost' (using password: NO)
SNap
Posts: 314
Joined: Wed 5. May 2004, 10:45
Location: Passau, Bavaria, Germany
Contact:

Post by SNap »

breitsch wrote:
What exactly do we copy if we have a brand new 1.2.8 phpwcms installation? the old phpwcms 1.2.6?
OK:
You have phpwcms 1.2.8 installed and running.

then

From the downloadarea on casa-loca.com download 2 zip-files:
exdata_mod_261for126.zip
and
exdata_mod_261for128.zip

then
read the install-readme in exdata_mod_261for128.zip

then
copy all files of exdata_mod_261for126.zip via ftp to your server

then
copy all files of exdata_mod_261for128.zip via ftp to your server(overwrites some files of exdata_mod_261for126)
don't forget the filebrowser_exd.php in the root directory

then
modify the files as described in install-readme

then go to backend an install the mod from the module-section


Why so complicated?
When you have/had phpwcms 1.2.6 with mod ExData 2.61 and now update to phpwcms 1.2.8 - then you just have to update ExData with the 261for128-file - so you don't have to care about created css files and templates. Clear?
why so complicated??? it's more than that... even your statement above is inconsistent ;)

you write: read installatione..128... upload.... upload.... do install statements.....

what now?? when i read installnotes at first it says modify files and then upload....

at now it's totally complicated! sry ;) :(

the best thing , i guess, would be to deliver all changes in files for standard phpwcms. that would be much easyier to handle since i can diff files that way and purge my own changes if i had some...most people i think wouldn't even have to do that... and i think it would be not that much effort for you to install it in an standard phpwcms and give us the files, don't you think?

i am not that bad programme, not an expert but not bad i think ;) but i am sitting here totally confused since i can't find the 'find' statements in these files...

besides that: great mod! nice work!

Cheers
SNap
'welcome to the real world!' datensysteme-lenk
breitsch
Posts: 473
Joined: Sun 6. Mar 2005, 23:12
Location: bern switzerland

Post by breitsch »

SNap wrote: you write: read installatione..128... upload.... upload.... do install statements.....

what now?? when i read installnotes at first it says modify files and then upload....
In that exact order (if you install in phpwcms-1.2.8 )!
1. read (just read it, don't DO anything!) the installation guide (of the 1.2.8-readme), thats just to give you all the required infos for the installation process and because the files look different in phpwcms-1.2.8.
2. upload the ExData 1.2.6 files
3. upload the ExData 1.2.8 files
4. modify the files as described in the readme. (if you do that local then you have to overwrite them on your server of course)

if you install in phpwcms 1.2.6!
1. read (just read it, don't DO anything!) the installation guide (of the 1.2.6-readme), thats just to give you all the required infos for the installation process.
2. upload the ExData 1.2.6 files
4. modify the files as described in the readme. (if you do that local then you have to overwrite them on your server of course)

I really can't (and don't want to) deliver modified phpwcms-files with the mod! OG wouldn't appreciate this, I guess!
http://www.youtube.com/watch?v=jqxENMKaeCU
because it's important!
breitsch
SNap
Posts: 314
Joined: Wed 5. May 2004, 10:45
Location: Passau, Bavaria, Germany
Contact:

Post by SNap »

ok now it's clear... maybe you can write it this clear in the readme's? ;)

maybe OG puts this mod in the dist ;)

Cheers and thx!
SNap
'welcome to the real world!' datensysteme-lenk
ssyfrig
Posts: 364
Joined: Tue 2. Mar 2004, 17:01
Location: Zürich / Switzerland
Contact:

Post by ssyfrig »

Hi

I use ExData MODULE 2.61with phpwcms 1.2.8

the hover and also the BG change doesn't work in my installation.

Any idea?

Code: Select all

/*row colors and mousefollow*/
.exd_row {} /*(leave this one empty!)*/
.exd_row_bg_0 { background:#696969; }
.exd_row_bg_1 { background:#CCCCCC; }
.exd_row_hover { background:#c3df56; }


thanks, Sven
breitsch
Posts: 473
Joined: Sun 6. Mar 2005, 23:12
Location: bern switzerland

Post by breitsch »

ssyfrig wrote: the hover and also the BG change doesn't work in my installation.
Some more info's would help!
Do you use Auto-Template?
http://www.youtube.com/watch?v=jqxENMKaeCU
because it's important!
breitsch
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

Hi Breitsch,

I just installed 261 on my localhost....all good
you should really be congratulated - this is really a major contribution.

Having said that, I think you 'sooner or later' need to provide a VIRGIN INSTALL FOR 128

I think you are the first to recognise that.....for newcomers - the install instructions are a wee bit unclear - anyway - just thanking you for your MAJOR investiment of time in this MOD - big thumbs up.

Oliver - if you happen across this thread - I hope that you might include this in the core of wcms.....Breitsch has spent tons of time getting it to where it is.

respect,
:)

UPDATE:
Since I installed this on my localhost to test first, I ran into a small problem, since I am running PHP in windows as fastCGI. Therefore
$_SERVER['SCRIPT_NAME'] returns the wrong path. So I needed to change all instances of $_SERVER['SCRIPT_NAME'] to $_SERVER['PHP_SELF'] inside this file:

inc_module/mod_exdata/inc_lib/exdata.classes.php
Last edited by jsw_nz on Sun 12. Nov 2006, 19:54, edited 2 times in total.
fopulu
Posts: 359
Joined: Tue 2. May 2006, 14:19
Location: Rhein-Main

Post by fopulu »

@breitsch
What about the shopping cart?
Have you an idea, when you've finished this part of the ExDataMod?
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

Hi Breitsch,

I searched through this thread - and at least for me, I did not notice 'template code' or examples to narrow output to a SINGLE ENTRY from a given category. What I have in mind is this... I am guessing it cannot be done as yet. However might be able to create a hack - something like custom repTags

Category:
Biblliography

In a given article in wcms - i want to pull a bilbliography reference out and show at bottom of page (example).

Smith, John, 2006, "Content Management Systems: A Review", Dover, London

So I would need the ability to access EXDATA table and pull only one instance out based on ID ....AND... output the selectied fields (AUTHOR, DATE, TITLE, PUBLISHER, LOCATION) as a formated string (adding comma and periods) to be placed in one <div>

- so basically a single item (no columns) based on CategoryID:ItemID

could you point me in the right direction where I could create a custom tag for EXDATA, something like frontend_render folder that exists in wcms for general repTags....

Cheers and thanks in advance,
:)

UPDATE:

Well, since exdata uses the same db connection, thought to give a try at making a standard repTag and put it in the frontend_render directory. Works! so plenty of possibiities to formatting exdata output. Here is the code I used:

Code: Select all

<?php
function get_bib_reference($bib_id,$dbcon) {
	$bib_id = intval($bib_id); 
	$sql  =	"SELECT field1, field2, field3, field4, field5 ";
	$sql .=	"FROM ".DB_PREPEND."phpwcms_exd_entries WHERE id = ".$bib_id;
	if($result = mysql_query($sql, $dbcon)) {
  		while ($row = mysql_fetch_array($result)) {
			$bib_author = $row['field1'];
			$bib_date = $row['field2'];
			$bib_title = $row['field3'];
			$bib_publisher = $row['field4'];
			$bib_location = $row['field5'];
		} // end while
	} // end if
	mysql_free_result($result);
	$bib_result = $bib_author.", (".$bib_date.") <em>".$bib_title."</em>, ".$bib_publisher.", ".$bib_location.".";
  	return $bib_result;
}
 // BIBLIO replacement
// returns a single bibliographic reference from exdata phpwcms_exd_entries table
 if( ! (strpos($content["all"],'{BIBLIO')===false)) { 
   $content["all"] = preg_replace('/\{BIBLIO:(\d+)\}/e','get_bib_reference("$1",$db);',$content["all"]); 
 } ?>
Tons of ideas come to mind,,,,
:D
breitsch
Posts: 473
Joined: Sun 6. Mar 2005, 23:12
Location: bern switzerland

Post by breitsch »

well, I have prepared once something like that but never used it.

put in the frontend_render directory:

Code: Select all

<?php
	/*list single entry frontend*/
	function gatherExdSingle($cat, $entry_id, $template=0){
		/*
    $cat            : Current category
    $entry_id       : id of entry
    $template=0     : template for entries
    */
    $exd =& new ExdataFrontend;
    
    if ($template == '0') { // use default template
			$event = "<div>{FIELD1} - {ENTRY1}, {ENTRY2}, {ENTRY3}, {ENTRY4}, {ENTRY5}, {ENTRY6}, {ENTRY7}, {ENTRY8}</div>";
		} else {
      $event = file_get_contents(PHPWCMS_ROOT."/include/inc_module/mod_exdata/inc_front/templates/".$template);
    }
    
		$sql = "SELECT * FROM " . $GLOBALS['tables']['exd_categories'] . " as cats WHERE id=$cat";
	  $result = mysql_query($sql)
			or die("Error: ".mysql_errno().": ".mysql_error()."<hr />" . $sql);
	  $fieldname = mysql_fetch_array($result);
	  mysql_free_result($result);
	  /*get the visibile-list from db*/
	  $sql = "SELECT * FROM " . $GLOBALS['tables']['exd_cat_vis'] . " as vis WHERE catid=$cat";
	  $result = mysql_query($sql)
			or die("Error getting visibile-list info: ".mysql_errno().": ".mysql_error()."<hr />" . $sql);
	  $visfield = mysql_fetch_array($result);
	  mysql_free_result($result);
	  /*get the contenttype-list from db*/
		$sql = "SELECT * FROM " . $GLOBALS['tables']['exd_cat_opt'] . " WHERE catid=$cat";
		$result = mysql_query($sql)
			or die("Error getting category info: " . mysql_error() . "<hr />" . $sql);
		$cat_dat = mysql_fetch_array($result);
		mysql_free_result($result);
		$events  = ""; //open listing
    
    if ($fieldname['id']==""){ //category was deleted but not the RT
    return "";
    }
    
    /*number of fields in current category*/
    ($fieldname['cat_field_number']) ? $n = $fieldname['cat_field_number'] : $n=8; //8 = compatible to ver.1

    /*get the entry from db*/
		$sql = "SELECT * FROM " . $GLOBALS['tables']['exd_entries'] . " WHERE " .
		  "id=".$entry_id." AND catid=".$cat." AND approved=1 ";
    
    $result = mysql_query($sql)
			or die("Error: ".mysql_errno().": ".mysql_error()."<hr />" . $sql);

    /*Define default or user language*/
    $loc_lang = $exd->exdata_detect_lang(); //returns the local settings or default 'en-us'
    $loc_lang = substr($loc_lang,0,2)."_".strtoupper(substr($loc_lang,0,2)); //use only language, not agent ($loc_lang,4,2)!
    /*Date_Formattings*/
    setlocale(LC_TIME, $loc_lang);
    $dateform = "%x";

    /*search for visible fields in case the default settings of the category is overwritten in entries*/
    $row_num = array(); //the number of entries to be shown
    $sort_array=array();
    /*visibility-check and counting for page-menu*/
    while ($row2 = mysql_fetch_array($result)) {
	    $iscontent=0;
	    $sort_temp=array();
        
        for ($j = 1; $j <= $n; $j++) {
          $invis = 0;
          /*if ($visfield['field'.$j.''] == 1 && $row2['vis_field'.$j.''] !== "vis"){ //field invisible
            $invis = 1;
            $sort_temp['field'.$j.'']="";
          }*/
          if ($visfield['field'.$j.''] == 0 && $row2['vis_field'.$j.''] == "inv"){ //field invisible
            $invis = 1;
            $sort_temp['field'.$j.'']="";
          }
          if ($row2['field'.$j.'']=="0:") { //(empty articlelink)
            $invis = 1; 
            $sort_temp['field'.$j.'']="";
          }
          if (($invis==0)) {  //entry must be shown
            //cell does exist
            $sort_temp['field'.$j.'']=$row2['field'.$j.''];
            $sort_temp['vis_field'.$j.'']=$row2['vis_field'.$j.''];
            $iscontent++;
          } 
        } //end for 
      $sort_temp['id']=$row2['id'];
      if ($iscontent != 0) array_push($sort_array, $sort_temp); //add record to array   
    } //end while
     if ($iscontent == 0) {
      $sort_temp=array(); //temporary array for visibility check
      $sort_temp['field1']="---";
      array_push($sort_array, $sort_temp); //add record to array
    }
    $row_num=$sort_array;
		  $y=1;
		  $z=24;
		/*start listing*/
			/* start adding items to the template*/
		    for ($j = $y; $j <= $z; $j++) {
            //when field is textarea
            if ($cat_dat['field'.$j.'']==1){  
              $row_num[0]['field'.$j.''] = nl2br ($row_num[0]['field'.$j.'']);
		          $row_num[0]['field'.$j.''] = stripslashes($row_num[0]['field'.$j.'']);
		        //when field is wysiwyg or articlelink
            } else if ($cat_dat['field'.$j.'']==2 or $cat_dat['field'.$j.'']==5) { 
		          $row_num[0]['field'.$j.''] = stripslashes($row_num[0]['field'.$j.'']);
            } else {
            	$row_num[0]['field'.$j.''] = stripslashes($row_num[0]['field'.$j.'']);
              $row_num[0]['field'.$j.''] = htmlspecialchars($row_num[0]['field'.$j.'']);
              $row_num[0]['field'.$j.''] = htmlentities($row_num[0]['field'.$j.'']);
            }
            //check visible
           /* if ($visfield['field'.$j.''] == 1 && $row_num[0][$i]['vis_field'.$j.''] !== "vis"){ //field invisible
              //cell does not exist
            } else*/ if ($visfield['field'.$j.''] == 0 && $row_num[0]['vis_field'.$j.''] == "inv"){ //field invisible
              //cell does not exist
            } else {
              //cell does exist
              $event = str_replace("{FIELD".$j."}", $fieldname['field'.$j.''], $event); //fieldname
              /*replace RT '{EF#}' with content depending on content type*/
              switch($cat_dat['field'.$j.'']) {
                default: // default
			            $event = str_replace("{ENTRY".$j."}", $row_num[0]['field'.$j.''], $event);
              	break;
	              case 3: //when field is date
                  // if ($row_num[0][$i]['field'.$j.'']) $event = str_replace("{EF".$j."}", strftime($dateform, strtotime($row_num[0][$i]['field'.$j.''])), $event);             
			            if ($row_num[0]['field'.$j.'']) $event = str_replace("{ENTRY".$j."}", $row_num[0]['field'.$j.''], $event);
              	break;
              	case 4: //when field is link or mail
                  $valuelnk = explode("|", $row_num[0]['field'.$j.'']); //explode text, target
                  ($valuelnk[2]) ? $valuelnk[2]=$valuelnk[2] : $valuelnk[2]=$valuelnk[0];
                  if ($valuelnk[1]=="mailto"){ //case mailto
                    if ($row_num[0]['field'.$j.'']) $event = str_replace("{ENTRY".$j."}", "<a href=\"mailto:".$valuelnk[0]."\">".$valuelnk[2]."</a>", $event);
                  } else if ($valuelnk[1]=="none"){ //case nothing
                    if ($row_num[0]['field'.$j.'']) $event = str_replace("{ENTRY".$j."}", $valuelnk[2], $event);                  
                  } else { //case link with target
                    //add http:// if not already there
                    if (!preg_match('/http:\/\/(.*?)\.(.*?)\.(.+)/i', $valuelnk[0]))
                      $valuelnk[0]="http://".$valuelnk[0];
                    if ($row_num[0]['field'.$j.'']) $event = str_replace("{ENTRY".$j."}", "<a href=\"".$valuelnk[0]."\" target=\"".$valuelnk[1]."\">".$valuelnk[2]."</a>", $event);
                  }
              	break;
	              case 5: //when field is artikellink
                  $valueart = explode(":", $row_num[0]['field'.$j.'']); //explode id, text
                  if ($valueart[0] == 0) { //case nothing
                    if ($row_num[0]['field'.$j.'']) $event = str_replace("{ENTRY".$j."}", $valueart[1], $event);               
                  } else { //case articlelink
                    if ($row_num[0]['field'.$j.'']) $event = str_replace("{ENTRY".$j."}", "[ID ".$valueart[0]."]".$valueart[1]."[/ID]", $event); 
                  }
              	break;
	              case 6: //when field is internal-image
                  $value = explode(":", $row_num[0]['field'.$j.'']); //explode id, width, height
				          if ($value[1]) { //check if id exists
					          /*get image*/
                    $auto_image = $exd->make_auto_image($value); 
                    /*write image*/
					          $event = str_replace("{ENTRY".$j."}", $auto_image[3], $event); //3=with pop-up, else 2
				          } else { //no image-data
				            $event = str_replace("{ENTRY".$j."}", $row_num[0]['field'.$j.''], $event);
				          }
              	break;
              	case 7: //when field is internal file
                    $value = explode(":", $row_num[0]['field'.$j.'']); //explode name, id, descr
                    if ($value[1]) { //check if id exists
			                /*get file*/
					            $auto_filelist = $exd->make_auto_file($value);
					            $event = str_replace("{ENTRY".$j."}", $auto_filelist, $event);
                    } else { //if no file then write the string
				              $event = str_replace("{ENTRY".$j."}", $row_num[0]['field'.$j.''], $event);
                    }
                break;
                case 8: //when field is GoogleMaps
                    $value = explode(":", $row_num[0]['field'.$j.'']); //explode name, id, descr
                    if ($value[0]) { //check if lat exists
			                /*get file*/
					            $gmap = $exd->make_GoogleMaps($value,$cat,$row_num[0]['id']);
					            $event = str_replace("{ENTRY".$j."}", $gmap, $event);
                    } else { //if no file then write the string
				              $event = str_replace("{ENTRY".$j."}", $row_num[0]['field'.$j.''], $event);
				            }
                  break;
              }
			      }
		    } //end for
          /*clean still empty entries*/   
		      for ($m = 1; $m <= 24; $m++) {
	      	$event = str_replace("{FIELD".$m."}", "", $event);
	        $event = str_replace("{ENTRY".$m."},", "", $event);
		      }
		return $event;
	}

if( ! ( strpos($content["all"],'{EXDSINGLE')===false ) ) {
  $content["all"] = preg_replace('/\{EXDSINGLE:(.+?):(.+?):(.+?)\}/ei', "gatherExdSingle(\"\$1\", \"\$2\", \"\$3\", \"0\", \"0\")" , $content["all"]);
  $content["all"]	= preg_replace('/\[ID (\d+)\](.*?)\[\/ID\]/e', 'get_article_idlink($1, "$2", $db);', $content["all"]);
}
?>

now change the pattern:

Code: Select all

<div>{FIELD1} - {ENTRY1}, {ENTRY2}, {ENTRY3}, {ENTRY4}, {ENTRY5}, {ENTRY6}, {ENTRY7}, {ENTRY8}</div>
for the RT to your needs
or place a template like:

Code: Select all

<div>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
 <tr>
  <td><strong>{FIELD1}</strong></td>
 </tr>
 <tr>
  <td>{ENTRY1}</td>
  <td>{ENTRY2}</td>
  <td>{ENTRY3}</td>
  <td>{ENTRY4}</td>
  <td>{ENTRY5}</td>
  <td>{ENTRY6}</td>
 </tr>
</table>
</div>
to directory: PHPWCMS_ROOT."/include/inc_module/mod_exdata/inc_front/templates

Then in the articles use the ReplacementTag:
{EXDSINGLE:[category-id]:[article-id]:0} (uses the pattern in the code)
or
{EXDSINGLE:[category-id]:[article-id]:[template-name]}

This RT reacts to the visibilty settings in the module and shows the rendered contentparts (images, links, articlellinks, google maps, ...)
http://www.youtube.com/watch?v=jqxENMKaeCU
because it's important!
breitsch
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

RT reacts to the visibilty settings
Thanks Breitsch - will take a close look at it - a better solution - might combine with my string formatting needs.
:D
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Clean Install v2.61 for 1.2.8 --> not valid MySQL

Post by Jensensen »

Hi Folks,

@Breitsch: great mod! Thanks.

Works (on test server), but when run (install) first time in Admin/Modules (client servers)

....phpwcms.php?do=modules

the following ERROR WARNING is shown:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /is/htdocs/wp10XXXXX_NQEPJG2VX2/www/include/inc_module/mod_exdata/main.inc.php on line 10


I guess, this is because their aren't any SQL-tables yet.

You get the Install-Button presented. And while clicking on "Install ExData Module v2.61" everything is ok.

But this ERROR with every new installations is VERY irritating and makes (no just me) insecure, using the EXDATA install routines!!!??

And in addition: why not putting all 2.61 files for 1.2.8 in JUST ONE ZIP archive???


Greetz
Jensensen


PS: putting EXDATA images outside the module folder - as described in INSTALL README e.g. copy all image files to ROOT/img does NOT function!!

They all still have to reside in the subdirectory 'img' in 'mod_exdata'...
Mmmarkus
Posts: 25
Joined: Sun 8. Jan 2006, 17:59

Post by Mmmarkus »

I have this call in the menu - but all the settings in phpwcms.php am correctly:

Code: Select all

phpwcms.php?do=modules&p=91&c=xy
from where comes the "91" ? :?

Update: i got it -> main.default.php :idea:
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

phpwcms.php?do=modules&p=91

Post by Jensensen »

91 is the EXDATA Module number as defined in 'phpwcms.php' around line 420:

case 91: // ExData Mod
...

This is to call the ExData Module.


@all

to avoid errors with version check in "main.inc.php", it is possible to strip of the check routines and to use main.inc.php as follows:

Code: Select all

<?php
// ExData Module...

// get needed files
include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/app-header.php');
include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/inc_tmpl/header.php'); // this has styles and javascript...
include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/main.default.php');

?>
Greetz
Jensensen
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
culda_a
Posts: 521
Joined: Tue 28. Feb 2006, 01:39
Contact:

Post by culda_a »

I have try to instal the exdata for 1.2.6 phpwcms, and when I press on the exdata module menu is not apear ... what did I do wrong?
ImagePackging design,labels, catalogs,postcards,
Post Reply