msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-09-22 13:25
Back to top
Reply with quote
|
I would like to display some simple images in a table constructed by using phpMyEdit.
So far the table is working only by showing text (graphic file names).
In the collumn description the code previously was as follows:
$opts['fdd']['Logo'] = array(
'name' => 'Logo',
'select' => 'T',
'maxlen' => 50,
'sort' => true
);
Then I added one extra line.
$opts['fdd']['Logo'] = array(
'name' => 'Logo',
'select' => 'T',
'maxlen' => 50,
'images' => 'ikony/logo/',
'sort' => true
);
My graphic file is located in a directory "/ikony/logo", which is one level bellow phpMyEdit.class.php
After inserting the line the table instead of displaying a graphic is showing the file name only.
Does anybody know how to handle such graphics?
I also do not know how to control the graphic dimension.
Marek Staniewski
|
sba
Joined: 31 Jul 2008
Posts: 12
Posted: 2008-09-22 13:49
Back to top
Reply with quote
|
i use the sql option to output images.
like this:
$opts['fdd']['Logo'] = array(
'name' => 'Logo',
'input' => 'VR',
'options' => 'LF' ,
'sql|LF' => 'CONCAT(\'<img src="ikony/logo/\', Logo, \'">\')',
'escape' => false,
);
|
msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-09-22 14:15
Back to top
Reply with quote
|
Thank you very much. It was helpfull advise. Now I see graphic in a table. But after correcting my code according to the bellow formmula I lost possibility to edit the field LOGO (the editing field is gone, only for LOGO collumn, for other collumns is everything OK)
Can yo tell me what is wrong here?
$opts['fdd']['Logo'] = array(
'name' => 'Logo',
'select' => 'T',
'maxlen' => 50,
'sort' => true,
'input' => 'VR', //od tego wiersza jest nowy kod
'options' => 'LF' ,
'sql|LF' => 'CONCAT(\'<img src="ikony/logo/\', Logo, \'">\')',
'escape' => false
);
By the way. I am a newbie to php and phpMyEdit. Wpould you mind (you or someone else reading it) to have look on some small problems I have with my tables?
Marek Staniewski
|
sba
Joined: 31 Jul 2008
Posts: 12
Posted: 2008-09-22 14:39
Back to top
Reply with quote
|
You have to define an further field:
//the text field to edit
$opts['fdd']['Logo'] = array(
'name' => 'Logo',
'select' => 'T',
'maxlen' => 50,
'sort' => true,
'options' => 'LAVCPD' , //show evrywhere
);
//'virtual' image-field, needs another name as 'Logo'
$opts['fdd']['LogoImage'] = array(
'name' => 'Logo image',
'input' => 'VR', //od tego wiersza jest nowy kod
'options' => 'LF' , //show only in list/filterlist
'sql|LF' => 'CONCAT(\'<img src="ikony/logo/\', Logo, \'">\')',
'escape' => false
);
|
msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-09-22 20:47
Back to top
Reply with quote
|
Thank you very much for your excellent support. Now it works and I am abble to add the right code to other tabels where graphics is displayed.
By the way I have another question:
1. Can I control some easy way image dimension?
2. Will you guide me in attaching a callendar popup?
Regards
Marek Staniewski
|
sba
Joined: 31 Jul 2008
Posts: 12
Posted: 2008-09-23 08:07
Back to top
Reply with quote
|
Hello Marek
Graphic Dimensions: Do you want output the height an width of the graphic in the img-tag?
If they are different for each data record i dont know how to do directly with pme... when its possible for you to store the dimensions in the data record then its no problem. simply output them in the sql-concat statement.
calendar:
include the jscalendar_1.0 js (see also pme manual)
this is a calendarfield-definition i use:
| Code: |
$opts['fdd']['htl_booking_deadline3'] = array(
'name' => 'Deadline3',
'select' => 'T',
'maxlen' => 10,
'sort' => false,
'calendar' => array(
'ifFormat' => '%d.%m.%Y'
'singleClick' => true,
'weekNumbers' => true,
'button' => false,
'showsTime' => false,
'label' => '<img src="layout/img/date.png" alt="Datum auswählen" style="padding-left: 2px;" />'),
'datemask' => $str_date_short, //fot the list-view
'sql|ACP' => "DATE_FORMAT(htl_booking_deadline3, '%d.%m.%Y')",
'sqlw' => IF($val_qas = '', NULL, CONCAT_WS('-',
SUBSTRING_INDEX($val_qas,'.',-1),
SUBSTRING_INDEX(SUBSTRING_INDEX($val_qas,'.',2), '.', -1 ),
SUBSTRING_INDEX($val_qas,'.', 1))),
'js' => array(
'regexp' => '/(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d/',
'hint' => 'Ungültiges Datum. Format tt.mm.jjjj erwartet',
'required' => false),
);
//then call:
new phpMyEdit_mce_cal($opts);
|
this looks difficult an maybe there are easier ways how to check the date-format...but for me it works fine.
Regards
Stefan
|
msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-09-24 10:29
Back to top
Reply with quote
|
Hello Stefan
I tried to make everything according to manual and your notes. Unfortunately still I was not able to get the callendar working.
If I give you an access to my table would you mind to have look what is wrong? There are several callendars needed, but other I would attach myself, just by copying a code.
I know that still I have problem to put a right code in the haading and to use an include command.
Anyway I suppose it is now only some small correction needed.
regards
Marek Staniewski
|
msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-10-04 12:17
Back to top
Reply with quote
|
Hi,
In spite of many trials I was not abble to run callendar. However it seems I am very close to do so.
Would you mind to see live the problem and say what can be wrong?
regards
Marek
| sba wrote: |
Hello Marek
Graphic Dimensions: Do you want output the height an width of the graphic in the img-tag?
If they are different for each data record i dont know how to do directly with pme... when its possible for you to store the dimensions in the data record then its no problem. simply output them in the sql-concat statement.
calendar:
include the jscalendar_1.0 js (see also pme manual)
this is a calendarfield-definition i use:
| Code: |
$opts['fdd']['htl_booking_deadline3'] = array(
'name' => 'Deadline3',
'select' => 'T',
'maxlen' => 10,
'sort' => false,
'calendar' => array(
'ifFormat' => '%d.%m.%Y'
'singleClick' => true,
'weekNumbers' => true,
'button' => false,
'showsTime' => false,
'label' => '<img src="layout/img/date.png" alt="Datum auswählen" style="padding-left: 2px;" />'),
'datemask' => $str_date_short, //fot the list-view
'sql|ACP' => "DATE_FORMAT(htl_booking_deadline3, '%d.%m.%Y')",
'sqlw' => IF($val_qas = '', NULL, CONCAT_WS('-',
SUBSTRING_INDEX($val_qas,'.',-1),
SUBSTRING_INDEX(SUBSTRING_INDEX($val_qas,'.',2), '.', -1 ),
SUBSTRING_INDEX($val_qas,'.', 1))),
'js' => array(
'regexp' => '/(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d/',
'hint' => 'Ungültiges Datum. Format tt.mm.jjjj erwartet',
'required' => false),
);
//then call:
new phpMyEdit_mce_cal($opts);
|
this looks difficult an maybe there are easier ways how to check the date-format...but for me it works fine.
Regards
Stefan |
|
msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-10-06 15:54
Back to top
Reply with quote
|
Hi Stefan
I still did not manage to use the callendar.
In your message is written:
"include the jscalendar_1.0 js (see also pme manual) "
I unfortunately do not understad it. I mean from where to take jscalendar_1.0 js and where exactly shall the command "include" be placed.
Could you let me know it? I saw that there are quite many observers of this view, therefore it may be useful for other non advanced users.
Marek
|
sba
Joined: 31 Jul 2008
Posts: 12
Posted: 2008-10-07 08:56
Back to top
Reply with quote
|
Hi Marek
First of all download the calendar scripts:
http://www.dynarch.com/projects/calendar/
include the files in your html-header:
| Code: |
<style type="text/css">@import url("jscalendar_1.0/calendar-gms.css");</style>
<script type="text/javascript" src="jscalendar_1.0/calendar.js"></script>
<script type="text/javascript" src="jscalendar_1.0/lang/calendar-de.js"></script>
<script type="text/javascript" src="jscalendar_1.0/calendar-setup.js"></script>
|
then initialize pme (be sure that you include the mce-cal class):
| Code: |
include(phpMyEdit-mce-cal.class.php);
...
$opts['fdd']['Datum'] = array(
'name' => 'Date',
'select' => 'T',
'maxlen' => 10,
'calendar' => array(
'ifFormat' => '%Y-%m-%d',
'singleClick' => true,
'weekNumbers' => true,
'button' => false,
'showsTime' => false,
'label' => 'Date'),
);
...
|
Now do the important call to phpMyEdit
_mce_cal
| Code: |
new phpMyEdit_mce_cal($opts);
|
I hope this helps you forward in your project.
I think, it would not be helpful for you if I publish my script, because its part of a big multilingual project and it looks quite difficult if you are not familiary with php.
Best Regards
Stefan
|
msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-10-07 14:28
Back to top
Reply with quote
|
Hi Stefan
I apreciate your patience.
I still fight with the callendar. Seem so to me now that I have almost everything done, except good result.
Bellow is a code of my table (abbreviated)
The html part of a code is placed in a separate file called "header.php" (shown bellow)
In the calling file I added all your instructions.
When I run my program then I get a message (from Internet Explorer) that there is no definition for 'calendar'. A 'calendar' is the only new function in calining program.
In html code I added the java scripts, but it seems to me that program is ignoring them. Even when I make a spel mistake in the java cript make then the program does not show any error.
I hope you will see some problem which I cannot find.
The contents of this file (header.php) is as follows:
<?php
session_start();
if($_SESSION['logowanie'] == 'user') {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--<title>Tabela <?php echo $opts['tb']; ?></title> byæ mo¿e to jest dobry zapis-->
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">@import url("jscalendar_1.0/calendar-gms.css");</style>
<script type="text/javascript" src="jscalendar_1.0/calendar.js"></script>
<script type="text/javascript" src="jscalendar_1.0/lang/calendar-pl-utf8.js"></script>
<script type="text/javascript" src="jscealendar_1.0/calendar-setup.js"></script>
<link rel="stylesheet"
</head>
<body class="oneColLiqCtrHdr">
<div id="container">
<div id="header">
<h1><a a> | <a href='Countries.php'>Countries</a> | <a href='Routes.php'>Routes</a> | <a href='../backuprestore/index.php'>Backup/Restore</a> | <a href="../index.php?wyloguj=y">Logout</a><br>
<!-- end #header -->
</h1>
</div>
<div id="mainContent">
<h1><?php echo $opts['tb']; ?></h1>
<?php
} else {
//header("Location: lokalizacja.html");
die();
}
?>
And the content of a calling file (routes.php) is as follows (code is very much abreviated):
<?php
require_once('config.db.php');
require_once('config.table.php');
include('extensions/phpMyEdit-mce-cal.class.php');
$opts['tb'] = 'Routes';
$opts['fdd']['ID'] = array(
'name' => 'ID',
'select' => 'T',
'options' => 'AVCPDRH', // auto increment
'maxlen' => 6,
'default' => '0',
'sort' => true
);
$opts['fdd']['StartRouteDate'] = array(
'name' => 'StartRouteDate',
'select' => 'T',
'options' => 'ACPVD',
'required' => true,
'calendar' => true
);
require_once('header.php');
require_once('extensions/phpMyEdit-mce-cal.class.php');
new phpMyEdit_mce_cal($opts);
//require_once('phpMyEdit.class.php');
//new phpMyEdit($opts);
require_once('footer.php');
?>
And content od footer.php:
<!-- end #mainContent --></div>
<!-- end #container --></div>
</body>
</html>
|
sba
Joined: 31 Jul 2008
Posts: 12
Posted: 2008-10-08 08:21
Back to top
Reply with quote
|
have you tried to get the calendar work without PME?
|
msta
Joined: 15 Sep 2008
Posts: 24
Posted: 2008-10-08 08:40
Back to top
Reply with quote
|
This is too advance question for me.
I know well how to contruct tables in phpMyEdit. I did not do any application not working with PME.
My applicatios are just for manipulating data in MySQL tables.
I thouth that if I have one calendar working then other calendars it will be easy for me to make.
Besides I suppose that I am very very close to get the calendar wotrking.
Are my java scripts in right place?
Why after including them the program does not recognise the command 'calendar' (what makes impression that these scripts are not working)?
Sorry for making you so much efforts.
I suggest that I would pay a bit for your support (if you would decide to have look to my codes directly on the place). my email address is msta@amsort.pl
Regards
Marek Staniewski
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2008-10-08 12:40
Back to top
Reply with quote
|
You don't need the "include" and the "require_once" for the mce_cal extension. Remove the include line and see what happens.
Also - it looks as if you have a typo in the javascript call, that may have just been an error in typing it into the forum, but it's worth checking.
If that doesn't work, please could you supply the database schema and the full php files and I'll have a look at it.
(I'm the author of the mce_cal extension, btw).
|
|
Post new topic
Reply to topic
|
|