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.
breitsch
Posts: 473
Joined: Sun 6. Mar 2005, 23:12
Location: bern switzerland

Post by breitsch »

@frold

thanks for the comment.
Sounds like a cool feature and it shouldn't be too difficult.

in ..mod_exdata/inc_front/func.inc.php

Code: Select all

find:
function gatherExd($cat, $main_template_file, $event_template_file) {

replace with:
function gatherExd($cat, $main_template_file, $event_template_file, $fieldnr) {

find:
	$exd_entries = $exd->make_entries($cat, $date, $event_template_file);

replace with:
	$exd_entries = $exd->make_entries($cat, $date, $event_template_file, $fieldnr);

find:
if( ! ( strpos($content["all"],'{EXDATA')===false ) ) {
	$content["all"] = preg_replace('/\{EXDATA:(.+?):(.+?):(.+?)\}/ei', "gatherExd(\"\$1\", \"\$2\", \"\$3\")" , $content["all"]);
}

replace with:
if( ! ( strpos($content["all"],'{EXDATA')===false ) ) {
	$content["all"] = preg_replace('/\{EXDATA:(.+?):(.+?):(.+?)\}/ei', "gatherExd(\"\$1\", \"\$2\", \"\$3\", \"0\")" , $content["all"]);
}
if( ! ( strpos($content["all"],'{FIELDDATA')===false ) ) {	
	$content["all"] = preg_replace('/\{FIELDDATA:(.+?):(.+?):(.+?):(.+?)\}/ei', "gatherExd(\"\$1\", \"\$2\", \"\$3\", \"\$4\")" , $content["all"]);
}
in ...mod_exdata/inc_lib/exdata.classes.php

Code: Select all

find:
function make_entries($cat, $date, $template=0){

replace with:
function make_entries($cat, $date, $template=0, $fieldnr=0){

find:
$event = file_get_contents(PHPWCMS_ROOT."/include/inc_module/mod_exdata/inc_front/templates/".$template);

add after:
if (!$fieldnr == 0) {
$y=$fieldnr;
$z=$fieldnr;
} else {
$y=1;
$z=8;
}

find:
for ($j = 1; $j <= 8; $j++) {

replace with:
for ($j = $y; $j <= $z; $j++) {

find:
$events = "<div>No Entries in this Category!</div>\n";

add after:
for ($m = 1; $m <= 8; $m++) {
$events = str_replace("{TF".$m."}", "", $events);
$events = str_replace("{EF".$m."}", "", $events);
}
this schould show you only the required field indicated in the RT:

{FIELDDATA:category#:front.template.php:?.entry.template.php:field#}

make sure you don't have '&nbsp;' in your template, because this will show empty lines!

does this help? even if it is not the cleanest code i've ever written :wink:
http://www.youtube.com/watch?v=jqxENMKaeCU
because it's important!
breitsch
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

wauw that works like a charm :D

A last thing if I want to use it with GT mod howto do that?

This will not work:

{GT:header}{FIELDDATA:1:frold.front.template.php:frold.entry.template.php:1}{/GT}

It prints

{GT:header} Frederik Frost Nielsen{/GT}

My frold.front.template.php is:

Code: Select all

{EXD_ITEMS}
My frold.entry.template.php is:

Code: Select all

{EF1}{EF2}{EF3}{EF4}{EF5}{EF6}{EF7}{EF8}
http://www.studmed.dk Portal for doctors and medical students in Denmark
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

breitsch >> no solution?
http://www.studmed.dk Portal for doctors and medical students in Denmark
vello
Posts: 44
Joined: Wed 24. Mar 2004, 12:21
Location: Estonia
Contact:

@trouble

Post by vello »

:( can't get exdata to the modules menu
is this mod working with RC4?
Vello
Ben
Posts: 558
Joined: Wed 14. Jan 2004, 08:05
Location: Atlanta
Contact:

Post by Ben »

This is just a guess, but the mod is most likely for the latest dev release - 1.2.3
Paal
Posts: 204
Joined: Wed 6. Oct 2004, 19:54
Location: Budapest, Hungary
Contact:

Post by Paal »

Hello,

Yesterday i has been installed exdata.MOD and has been worked fine. I made new category, and add new entrys for categorys.

Today I logged in backand/modules and say this the extdata.MOD:

Code: Select all

Other modules might follow. GT MOD will be moved to admin section.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\var\www\include\inc_module\mod_exdata\main.inc.php on line 10
ExData Module Administration Area

Welcome to the ExData Module. You can integrate a simple but flexible database.

To install the mod make sure you have read the readme for the changes that needed to be made to the base. Once that is done you can click the button below to setup the database.
Install ExData MOD>>
Tables and all data ok in database!

Tables name:
_phpwcms_exd_cat_dat
_phpwcms_exd_cat_img
_phpwcms_exd_categories
_phpwcms_exd_entries

in /mod_exdata/inc_lib/main.config.php:
$prefix: "_"

Why say this message?

Thx, Paul
vello
Posts: 44
Joined: Wed 24. Mar 2004, 12:21
Location: Estonia
Contact:

Post by vello »

I get mysql warning too, when tried to use install.php
Now I think I go along with css tables
Vello
breitsch
Posts: 473
Joined: Sun 6. Mar 2005, 23:12
Location: bern switzerland

Post by breitsch »

@frold

I did not check this yet, but I'm bretty sure, that if you want to use GT MOD inside ExDataMod you have to place the part:

Code: Select all

// casa-loca ExData MOD
// Coypright (C) 2005
if($phpwcms["exdata_mod"]) { //enabled/disable MOD
	require_once ('./include/inc_module/mod_exdata/inc_front/func.inc.php');
}
in content/inc_front/content.func.inc.php
BEVOR the '// Jérôme's Graphical Text MOD' part.

Try it and give me a feedback please.

---------------------------------

@Ben and vello

ExData is working with the dev release.
it's not tested with RC4.

But I think, the main problems in RC4 will be the somewhat different structure of the following files:


phpwcms.php
rss.php
include/inc_front/content.func.inc.php

and the fact, that in the dev release the conf.inc.php file is in: config/phpwcms/
while in RC4 it is in:
include/confic/

so you have to make the modifications of these files accordingly during installation.

--------------------

@paal

there seems to be a problem with that. i will fix that in the next version.
for now:
once you have installed ExData mod make this your include\inc_module\mod_exdata\main.inc.php file:

Code: Select all

<?php
// calendar modules...
// 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'); 
include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/main.default.php');
?>
so it won't check every time you enter if the mod is already installed or not (in your case you can be sure that it is).
With this change it will work fine!
[/quote][/i]
http://www.youtube.com/watch?v=jqxENMKaeCU
because it's important!
breitsch
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

breitsch wrote:@frold

I did not check this yet, but I'm bretty sure, that if you want to use GT MOD inside ExDataMod you have to place the part:

Code: Select all

// casa-loca ExData MOD
// Coypright (C) 2005
if($phpwcms["exdata_mod"]) { //enabled/disable MOD
	require_once ('./include/inc_module/mod_exdata/inc_front/func.inc.php');
}
in content/inc_front/content.func.inc.php
BEVOR the '// Jérôme's Graphical Text MOD' part.

Try it and give me a feedback please.
Nope it doesnt work

I have tried:

Code: Select all

// Jérôme's Graphical Text MOD
// Coypright (C) 2004 by 
if($phpwcms["gt_mod"]) { //enabled/disable GT MOD
    require_once ('./include/inc_module/mod_exdata/inc_front/func.inc.php'); 
	require_once ('include/inc_module/mod_graphical_text/inc_front/gt.func.inc.php');
}
AND

Code: Select all

// Jérôme's Graphical Text MOD
// Coypright (C) 2004 by 
// casa-loca ExData MOD 
// Coypright (C) 2005 
if($phpwcms["exdata_mod"]) { //enabled/disable MOD 
   require_once ('./include/inc_module/mod_exdata/inc_front/func.inc.php'); 
} 
if($phpwcms["gt_mod"]) { //enabled/disable GT MOD
	require_once ('include/inc_module/mod_graphical_text/inc_front/gt.func.inc.php');
}
http://www.studmed.dk Portal for doctors and medical students in Denmark
breitsch
Posts: 473
Joined: Sun 6. Mar 2005, 23:12
Location: bern switzerland

Post by breitsch »

@frold

I see!
it works only if you put the GT-tag directly in the entry-field in ExData Mod.
Like: {GT:style1}Titel AB{/GT}
If it's just in 1 field it may be an option, but if it would be for all fields then it's nothing of course!

But this, as I mentioned, works only with the Exdata Entra before the GT Entry in include/inc_front/content.func.inc.php

Code: Select all

// casa-loca ExData MOD
// Coypright (C) 2005
if($phpwcms["exdata_mod"]) { //enabled/disable MOD
    require_once ('./include/inc_module/mod_exdata/inc_front/func.inc.php');
}
// Jérôme's Graphical Text MOD
// Coypright (C) 2004 by
if($phpwcms["gt_mod"]) { //enabled/disable GT MOD
	require_once ('include/inc_module/mod_graphical_text/inc_front/gt.func.inc.php');
}
all this before:

Code: Select all

// include external PHP script (also normal HTML snippets) or return PHP var value
if( ! ( strpos($content["all"],'PHP')===false ) ) {
	$content["all"] = render_PHPcode($content["all"]);
}
I will have a closer look at this problem for the next version. I guess, that GT Mod is not designed to handle html-code what it should to handle your needs. (The rendered {FIELDDATA:X:X:X:X} RT is html, not text only)
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,

Very impressive mod...

Had a few questions however:

From what I gather this mod takes a basic 'list all' strategy. Great for outputting lists that peridically get changed. My question is....would it be possible to create a rep tag syntax such that a specific entry from phpwcms_exd_entries is chosen and output to frontend. (Frold mentioned something similar - ) At present the category ID is the primary parameter,

{EXDATA:[category-id]:[front.template]:[entry.template]}

Would be nice if the entry ID is also considered a parameter.....for that matter, since the 'catid' is present in phpwcms_exd_entries table...perhaps a direct appraoch could be made....(This would be nice in cases where given data is displayed in more that one wcms article....eliminating the need to do multiple edits)

{EXDATA_ENTRY:[entry-id]:[front.template]:[entry.template]}

with the entry ID being the sole criteria for such...obviously the ability to customise front.inc.php leads me to believe this is doable....

Just a couple of other comments for setup....
might want to include line numbers in setup instructions, particulary with finding:

Code: Select all

// include external PHP script (also normal HTML snippets) or return PHP var value
if( ! ( strpos($content["all"],'PHP')===false ) ) {
	$content["all"] = render_PHPcode($content["all"]);
}
in /include/inc_front/content.func.inc.php
(it is considerably higher up in file, took me a wee bit of time to figure this part out)

Also a couple of ideas for the enhancement of image function:
(1) change hard-coded ' filestorage' to $phpwcms["file_path"] which defaults to this.

(2) offer the option that if image dimensions are not provided, php retrieves existing image width and height and fills out fields on refresh....or if only one parameter is provide then php would retireve original image size info and fill out other paramter to maintain proportions....on refresh

Want to thank you for all your work on this mod...a great addition to wcms....

:D :D
Paal
Posts: 204
Joined: Wed 6. Oct 2004, 19:54
Location: Budapest, Hungary
Contact:

Post by Paal »

breitsch wrote:@paal


there seems to be a problem with that. i will fix that in the next version.
for now:
once you have installed ExData mod make this your include\inc_module\mod_exdata\main.inc.php file:

Code: Select all

<?php
// calendar modules...
// 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'); 
include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/main.default.php');
?>
so it won't check every time you enter if the mod is already installed or not (in your case you can be sure that it is).
With this change it will work fine!
Hello Breitsch,

Now working but all admin pages say (after module-footer) this:

Code: Select all

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\var\www\include\inc_module\mod_exdata\main.inc.php on line 11
ExData Module Administration Area

Welcome to the ExData Module. You can integrate a simple but flexible database.

To install the mod make sure you have read the readme for the changes that needed to be made to the base. Once that is done you can click the button below to setup the database.
Install ExData MOD>>
:)
Paal
Posts: 204
Joined: Wed 6. Oct 2004, 19:54
Location: Budapest, Hungary
Contact:

Post by Paal »

Hm, I check the main.inc.php source:

Code: Select all

// calendar modules...
// 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'); 

if(!$_SESSION['exd_installed']) {
	$is_tab = mysql_query('SHOW TABLES FROM ' . $phpwcms["db_table"] . ' LIKE "%phpwcms_exd_entries"');
	if (mysql_num_rows($is_tab) > 0) {
		$_SESSION['exd_installed'] = 1;
		include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/main.default.php');
	} else {
		include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/install/install.php');
	}
} else {
	include (PHPWCMS_ROOT.'/include/inc_module/mod_exdata/main.default.php');
}
The query (my database name: i-develop):
"SHOW TABLES FROM i-develop LIKE %phpwcms_exd_entries"

sql result:

Code: Select all

SHOW TABLES FROM i-develop LIKE %phpwcms_exd_entries
You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '-develop LIKE %phpwcms_exd_entries' at line 1
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

breitsch wrote:(The rendered {FIELDDATA:X:X:X:X} RT is html, not text only)
Ahhhh

It works now without any other modification except the following :D

When:

frold.front.template.php is:
{EXD_ITEMS}


frold.entry.template.php is:
{EF1}{EF2}{EF3}{EF4}{EF5}{EF6}{EF7}{EF8}

And exdata.css is empty.. then it is outputting only text ;-)


I really have to thank you for this mod - it's can be used on so many cools way :D
http://www.studmed.dk Portal for doctors and medical students in Denmark
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

:oops: :oops: :oops:

another thing

:oops: :oops: :oops:

I have a php files in the root called articles.php

How do I include you script in a that file?

I tried to insert:

require_once ('include/inc_module/mod_graphical_text/inc_front/gt.func.inc.php');


But that wasnt enough...

I would really like to reuse the entered ExData Entries in that file...
http://www.studmed.dk Portal for doctors and medical students in Denmark
Post Reply