PDA

View Full Version : Problems with parsing variables


Viscum
10-21-2005, 07:37 PM
Hi Brian,
first, congrats to this really awesome script!
I got the license a few days ago, and it satisfies almost all of my wishes.

But there is a question for the parsed variables.

Problem 1
To can see, what i mean, you can visit the not-yet-published site at www.frg.at/index.php (http://www.frg.at/index.php)

I use the blog-mode on the index.php, but if i use the [date] variable on another place, it wont be parsed. So i donīt get a value for my booking script, because i always get back [date] instead of a value.

When i use the list-mode, like on the page www.frg.at/kalenderliste.php (http://www.frg.at/kalenderliste.php) everything is working perfect!
is there a workaround for this?

Problem 2
It would be useful to be able to link directly to some events. And i suppose the [eid] variable was thought for that. But i donīt get any values for this variable. In which mode can i use it?

many thanks for any help!
best regards
Viscum

Brian
10-21-2005, 11:49 PM
1) Which mode(s) does the [date] variable not parse for you?

2) eid is a unique number for that particular event. It's not used to display that event. Can you give me an example of how you'd like for it work?

Viscum
10-22-2005, 09:01 PM
Hi Brian,
thanx for your quick reply!

1.

I tried to get the [date] variable in blog-mode.
Here is the Code of the blog-template i tried to use:

<!--head-->
<!--date-->
<table border="0" cellpadding="1" cellspacing="0" bgcolor="#276983" class="tableListings">
<tr class="tableDate">
<td><span class="newDate">[date]</span> <span align="right" class="newTime"></span></td>
</tr>
</table>
<!--date-->
<!--body-->
<table class="tableListings" [mouseover]>
<tr>
<td class="tableCategory s2[category]">&nbsp;</td>
</tr>
<tr>
<td class="tableTitle">[title]<br />
<span class="tableDescr">[categories]<br />
[date]<br />
[time]<br />
<br />
[descr]<br /><a href='booking.php?date=[date]&time=[time]&title=[title]&cat=[categories]'>Anmeldung zu dieser Veranstaltung</a><br />
</span></td>
</tr>
</table>
<br />
<!--body-->
<!--foot-->
<!--foot-->
<!--empty-->
<table border="0" class="tableListings tableTime">
<tr>
<td><center>
Keine Eintr&auml;ge f&uuml;r diesen Tag.
</center></td>
</tr>
</table>
<!--empty-->


It seems, that it depends on where i insert the code.
Between the <!-- date--> tags, only the [date] variable gives back a value. but only the [date]!
Between the <!--body--> tags all variables work but the [date] ...

was this clear? otherwise i try again to explain, what i mean.

2.
It would be useful, if there would be a variable to link directly to an event. e.g. for a link in an email or something like that ....

thanks in advance
viscum

Brian
10-22-2005, 09:18 PM
I'll take a look at this when I get back to my office next week. :)

Viscum
10-26-2005, 03:26 PM
Great!
i am awaiting your ideas:)

best regards
viscum

Brian
10-26-2005, 09:19 PM
Can you open a support ticket with the URL and login information for your Setup Manager?

Brian
10-26-2005, 09:26 PM
Never mind. This will work in the next release. :)

I hadn't thought of using the parse variables the way you did, so the date wasn't running through the complete parse process.

Viscum
10-26-2005, 09:34 PM
Hi Brian,
so what to do for me now? :confused:
open the ticket ...
or waiting for the next release, which will be released ... when???
;)

And the way i used it, works perfect in the list mode!!!:clap:

best regards
viscum

Brian
10-26-2005, 09:37 PM
Give me till the weekend to get the next release out.

If you tell me the encoder version you're using via a support ticket, I'll send you the updated file to test.

Viscum
10-26-2005, 09:50 PM
sounds more than great!:thumbs_up
ticket is on its way!
best regards
viscum

Viscum
10-26-2005, 10:00 PM
tested it right now - and works perfect!!!
many many thanks!

Viscum
11-16-2005, 10:47 PM
Hi Brian,
itīs me again with a little problem concerning the [date] variable in blog-mode.

It now gives me the correct date, but itīs not parsed (or at least not complete) like in list-mode.
In list-mode i use
$DF = "l - d.m.Y ";
and it gives me something like e.g. monday - 28.11.2005

In blog mode i use the same config, but i only get 28.11.2005
The day of the week is missing (suppose not parsed).

This would not be a big thing if i would not use this variable for a form, where the values are compared to the actual date.

A much easier way would be, if there would be a method to get php-code working in the templates. Then my problem would not be that urgent ;)

any workarounds or solutions for that?
Thanks in advance
best regards
Viscum

Brian
11-17-2005, 09:22 AM
This is how it's designed. Just as a simple way to pass the date.

You could use PHP's mktime and date functions to determine the day name in your receiving script. If you need help, let me know and I'll see if I can come up with something. :)

Viscum
11-19-2005, 10:26 PM
Hi Brian,
thanks for your immidiate reply again!

They way i handle it at the moment is as follows:

in the blog- and the monthly-template i use a form like this:
Code in the templates

<form name="event" method="post" action="form/phorm.php">
<input type="hidden" name="PHORM_CONFIG" value="config3.php" />
<input type="hidden" name="PHORM_NAME" value="event" />
<input type="hidden" name="Veranstaltung" value="[title]" />
<input type="hidden" name="Datum" value="[date]" />
<!-- will be processed as $Datum -->
<input type="hidden" name="Zeit" value="[time]" />
<input type="hidden" name="Art" value="[categories]" />
<input class="invisible" type="submit" name="Submit" value="zur Anmeldung" tabindex="1" />
</form>

So every event has a single button to be able to make orders directly from the list.

This form processes the values to a second form, where i did a little "coding" to check, if the date is in the past (where no orders can be made) or in the future, where the further informaton of the user will be required.
The code i used to check the date is (translated some of the variables just to make it easier for u to follow):
Code in the second Form

<?php
list ($weekday, $day, $month, $year) = split('[/.-]', $Datum);
// Check of date
$eventdate=$year*10000+$month*100+$day;
$today=date("Y")*10000+date("m")*100+date("d");
// visibility of the form
if ($eventdate >= $today)
{$msg = array (
type=> "",
text=> "");}
else
{$msg = array (
type=> hidden,
text=> "This event is over! No orders are possible!!!");};
echo $msg[text];
?>

and the type of the $msg changes the settings vis CSS

<form id="<?php echo $msg[type] ?>" name="event" method="post" action="phorm.php">
<input type="hidden" name="PHORM_CONFIG" value="config.php" /
........


The problem i have is in the listing of the date, because in the blog-template its like "28.11.2005", whereas in the monthly-template its like "weekday -28.11.2005".
So i get errors, depending if the requests come from the calendar in blog-design like at my start page, or from the listing-pages, where i use the list-design of the calender.

I know, the easiest way would be to show the date in the same style in both templates .... ;) Then everything would work quite perfect.

Although the smartest way would be to show or hide the button for orders in the calender itself, because it would prevent users to make one possibly useless click. So this i a matter of usability.

So if you have a sophisticated solution for my problem i would be most interested to hear it.

thanks again in advance
and best regards

Viscum
PS: i hope, i expressed myself quite clear ... i do have the tendency to make things more complicated as necessary ;-)

ve9gra
11-20-2005, 09:22 AM
I beleive Brian meant that in your script where you use the date being sent from the Blog, here's what you'd do. (for clarity I'm going to use constants for a few values)

$dateFromBlog = "28.11.2005";
list($dDay, $dMonth, $dYear) = explode(".", $dateFromBlog);
$dayForScript = date("l",mktime(0,0,0,$dMonth,$dDay,$dYear));
$newDate = $dayForScript . " - " . $dateFromBlog;

And then you can use $newDate in your script.

Does this help?

Brian
11-20-2005, 09:23 AM
Try this (untested, but should be in the right direction if it doesn't work):

list ($day, $month, $year) = split('[/.-]', $Datum);
$weekday = date("l", mktime(0,0,0,$month,$day,$year));

ve9gra
11-20-2005, 09:25 AM
I guess I should've looked at his script a bit more before spitting out that code. :P

Your's is cleaner.

Viscum
11-21-2005, 06:16 AM
Hi,
thank you both for your codes and ideas!!!
But i think there was a little missunderstanding, in what i want to do.
Not getting the weekday was my problem, but the different format of the [date] variable of the two templates. And my problem that had highest priority was to check the date on actuallity.
But the different formats of the [date] in the templates led to errors.

But you both brought me on the right way with your ideas!!!
I changed the form in the templates as follows:
Code in blog-template:

<form name="event" method="post" action="form/phorm.php">
<input type="hidden" name="PHORM_CONFIG" value="config3.php" />
<input type="hidden" name="PHORM_NAME" value="event" />
<input type="hidden" name="Veranstaltung" value="[title]" />
<input type="hidden" name="Datum" value="[date]" />
<input type="hidden" name="blogdate" value="[date]" /> //added
<input type="hidden" name="Zeit" value="[time]" />
<input type="hidden" name="Art" value="[categories]" />
<input type="submit" name="Submit" value="zur Anmeldung" tabindex="1" />
</form>

Code in monthly-template:

<form name="event" method="post" action="form/phorm.php">
<input type="hidden" name="PHORM_CONFIG" value="config3.php" />
<input type="hidden" name="PHORM_NAME" value="event" />
<input type="hidden" name="Veranstaltung" value="[title]" />
<input type="hidden" name="Datum" value="[date]" />
<input type="hidden" name="monthlydate" value="[date]" /> //added
<input type="hidden" name="Zeit" value="[time]" />
<input type="hidden" name="Art" value="[categories]" />
<input class="invisible" type="submit" name="Submit" value="zur Anmeldung" tabindex="1" />
</form>

Code in second form:

<?php
// Variable from blogtemplate
list ($day, $month, $year) = split('[/.-]', $blogdate);
// Variable from Monthlytemplate
list ($weekday, $day, $month, $year) = split('[/.-]', $monthlydate);
// Check of date
$eventdatum=$jahr*10000+$monat*100+$tag;
$today=date("Y")*10000+date("m")*100+date("d");
// Results
if ($eventdatum >= $today)
{$msg = array (
typ=> "",
text=> "");}
else
{$msg = array (
typ=> hidden,
text=> "This event is over. No Orders possible anymore!");};
echo $msg[text];
?>


Problem Solved!!
So thank you both for your input!
best regards
Viscum