PDA

View Full Version : Newbie help!


pippofaina
12-15-2003, 04:32 AM
Hi guys, i don't know ANYTHING about PHP, but i found easily calendar fantastic and i don't want to avoid to insert it in my homepage only because of my php ignorance, so please help me.

There's a way to insert php code in an .asp page? My homepage is in .asp because of an application that nedds thise language, so i can't rename it in .php.

Please help me guys! ;)

A newbie

Brian
12-15-2003, 10:36 AM
PHP applications must have PHP language support installed on the server. You would need to check with your web host to determine if PHP scripts can be ran on the server. If so, it should natively support the PHP extension.

If you need an affordable web host that supports PHP and mySQL, consider www.iHostParadise.com (http://www.iHostParadise.com) for solutions to your hosting needs.

pippofaina
12-15-2003, 10:58 AM
Hi Papa, maybe my english is not so good so u don't have catch the problem.

I have a website all in html, with only html pages. I've changed my index page with .ASP extension only to can run an ASP application.

Then i found Easily calendar and i want to put it in my index.ASP page, but i don't know wich parts of script code cut and past in my index.ASP page.

I've tried demo.php page on my webspace and it's running, also with my changes (graphics, colors, events, etc.).

Thanx 4 the help in advance....

PF

revoemag
12-15-2003, 11:13 AM
Is your webserver using Apache? If so, then it is possible to configure it to parse the .asp files for php code. All you would have to do is use the following tags in your .asp files:

<script language="php">
...php code for calendar goes here...
</script>

I'll find the commands to make apache parse asp files for php code and post it soon.

rev

revoemag
12-15-2003, 12:21 PM
You can add the following line the httpd.conf file or in a .htaccess file:

AddType application/x-httpd-php .php .asp

This will force Apache to parse asp files for php code as well. I am not sure if this will have any harmful repurcussions on the asp code (i don't think so), but if it causes any problems, you know exactly where to turn it off. You can also add any number of extensions (eg. .html, .css, etc) to force apache to parse it for php code. You just need to make sure to use <?php ... ?> tags or <script language="php"> ... </script> tags.

For IIS, you will either need access to the registry or the Internet Services Manager MMC.

Hope this helps,

rev

pippofaina
12-15-2003, 12:45 PM
Guys, i'm too ignorant! :(

I don't know if my webserver supports apache, but i think no. In any case i don't know what code i have to put in my document to let him go!

I tried to cut and past this code:

<? require ("escal.php"); ?>
</div>
<?
if (!$mo) $mo=date("m");
if (!$yr) $yr=date("Y");
$yb=$yr;
$yf=$yr;
$mb=$mo-1;
if ($mb<1) {$mb=12; $yb=$yr-1;}
$mf=$mo+1;
if ($mf>12) {$mf=1; $yf=$yr+1;}
?>
<table width="174" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><a href="<? echo "$PHP_SELF?mo=$mb&yr=$yb" ?>">arrowsx.jpg</td>
<td align="center">&nbsp;</td>
<td align="right"><a href="<? echo "$PHP_SELF?mo=$mf&yr=$yf" ?>">arrowdx.jpg</td>
</tr>
</table>


that is in demo.php between <body> tags.

Even if i use <script language="php"> tag before this code (closed by </script> tag at the end of it) i can't solve the problem. Are other things to be setted in other files like escalEV and escalAE? Also Escal.php must be changed?

Please take a look to this link: http://calvaryhorns.com/calendar.html

This guy putted the escalendar (php) in a simply html file!

pippofaina
12-15-2003, 01:17 PM
this is how i'd like my asp page would be:

http://www.usbtavernerio.it/escalendar/demoasp.asp



the calendar shoud be over the news scrolling boxes, but it doesn't appear: if u would help me u could see in the page code what is wrong........

Brian
12-15-2003, 01:19 PM
Originally posted by pippofaina@Dec 15 2003, 12:45 PM
I don't know if my webserver supports apache, but i think no. In any case i don't know what code i have to put in my document to let him go!
If your server doesn't support PHP then the calendar scrips won't work.

pippofaina
12-15-2003, 01:23 PM
Originally posted by pippofaina@Dec 15 2003, 09:58 AM

I've tried demo.php page on my webspace and it's running, also with my changes (graphics, colors, events, etc.).


If demo.php is running on my server, so i have apache on my server? Demo.php as supllied WORKS, i just don't know which part of which file i've to insert in my asp page!

see the page i linked above

revoemag
12-15-2003, 01:34 PM
Actually, at the calvaryhorns.com page, he is using frames. The calendar is actually in the index.php file.

In your case, I'm not 100% sure how you'd add php code to your asp files correctly. Is there a web address you could give me so I can determine if you are using an apache based web server?

I will do some tests with mixing asp and php code in one page.

rev

revoemag
12-15-2003, 01:45 PM
Your site is using IIS so the above .htaccess fix will not work. I will continue to work on this, but it is beginning to look like it may not be possible at this point in time.

I wouldn't give up hope yet, though. If there's a will, there's a way.

rev

tomB
12-15-2003, 03:21 PM
I'm not convinced that this is your only problem but I found many syntax errors in your code for the calendar. Here's what I found and a recommendation for changing it.

Good Luck,

tomB


Your code!

<table align="center">
<tr>
&nbsp; <td align="center">
&nbsp; <div align="center">
&nbsp; &nbsp; &nbsp; <script language="php">&nbsp; <<== move to beginning of table structure
&nbsp; &nbsp; <? require ("escal.php"); ?>
&nbsp; </div>
&nbsp; <?
&nbsp; &nbsp; if (!$mo) $mo=date("m");
&nbsp; &nbsp; if (!$yr) $yr=date("Y");
&nbsp; &nbsp; $yb=$yr;
&nbsp; &nbsp; $yf=$yr;
&nbsp; &nbsp; $mb=$mo-1;
&nbsp; &nbsp; if ($mb<1) {$mb=12; $yb=$yr-1;}
&nbsp; &nbsp; $mf=$mo+1;
&nbsp; &nbsp; if ($mf>12) {$mf=1; $yf=$yr+1;}
&nbsp; ?>
&nbsp; <table width="174" border="0" cellspacing="0" cellpadding="0" align="center">
&nbsp; &nbsp; &nbsp; <tr>
&nbsp; &nbsp; &nbsp; &nbsp; <td>
&nbsp; &nbsp; &nbsp; <a href="<? echo "$PHP_SELF?mo=$mb&yr=$yb" ?>">&nbsp; <<== need to switch '\"' interior quotes
&nbsp; &nbsp; &nbsp; arrowsx.jpg
&nbsp; &nbsp; </td>
&nbsp; &nbsp; &nbsp; &nbsp; <td align="center">&nbsp;</td>
&nbsp; &nbsp; &nbsp; &nbsp; <td align="right">
&nbsp; &nbsp; &nbsp; <a href="<? echo "$PHP_SELF?mo=$mf&yr=$yf" ?>">&nbsp; <<== need to switch '\"' interior quotes
&nbsp; &nbsp; &nbsp; arrowdx.jpg
&nbsp; &nbsp; </tr>
&nbsp; </table>
&nbsp; </script>&nbsp; <<== script close tag not in correct position
&nbsp; </td>
</tr>
<tr>
&nbsp; <td>&nbsp;</td>
</tr>
&nbsp; &nbsp; &nbsp; <<== table not closed

-----------------------------------------------------
Changed code:

<script language="php">
<table align="center">
&nbsp; <tr>
&nbsp; <td align="center">
&nbsp; &nbsp; <div align="center">
&nbsp; &nbsp; <? require ("escal.php"); ?>
&nbsp; &nbsp; </div>
&nbsp; &nbsp; <?
&nbsp; &nbsp; if (!$mo) $mo=date("m");
&nbsp; &nbsp; if (!$yr) $yr=date("Y");
&nbsp; &nbsp; $yb=$yr;
&nbsp; &nbsp; $yf=$yr;
&nbsp; &nbsp; $mb=$mo-1;
&nbsp; &nbsp; if ($mb<1) {$mb=12; $yb=$yr-1;}
&nbsp; &nbsp; $mf=$mo+1;
&nbsp; &nbsp; if ($mf>12) {$mf=1; $yf=$yr+1;}
&nbsp; &nbsp; ?>
&nbsp; &nbsp; <table width="174" border="0" cellspacing="0" cellpadding="0" align="center">
&nbsp; &nbsp; &nbsp; <tr>
&nbsp; &nbsp; &nbsp; &nbsp; <td>
&nbsp; &nbsp; &nbsp; <a href="<? echo \"$PHP_SELF?mo=$mb&yr=$yb\" ?>">
&nbsp; &nbsp; &nbsp; &nbsp; arrowsx.jpg
&nbsp; &nbsp; &nbsp; </a>
&nbsp; &nbsp; &nbsp; </td>
&nbsp; &nbsp; &nbsp; &nbsp; <td align="center">&nbsp;</td>
&nbsp; &nbsp; &nbsp; &nbsp; <td align="right">
&nbsp; &nbsp; &nbsp; <a href="<? echo \"$PHP_SELF?mo=$mf&yr=$yf\" ?>">
&nbsp; &nbsp; &nbsp; &nbsp; arrowdx.jpg
&nbsp; &nbsp; &nbsp; </a>
&nbsp; &nbsp; &nbsp; </td>
&nbsp; &nbsp; </tr>
&nbsp; &nbsp; </table>
&nbsp; </td>
&nbsp; </tr>
&nbsp; <tr>
&nbsp; <td>&nbsp;</td>
&nbsp; </tr>
</table>
</script>

pippofaina
12-15-2003, 03:45 PM
thamx guys for your support: here in italy is 8.44 p, and i must go to the gym now, but when i come back i'll check my code mistakes....

i've thought to use frames in my index page:


index.html with left column in .php with the calendare and with right column in asp with asp application.

but I HATE frames...... :angry:

revoemag
12-15-2003, 03:56 PM
You might try including a php file in asp.

In index.asp:
<!--#include file="/calendar.php"-->

This way asp code stays in the asp file and php code stays in the php file. Actual usage is still unknown to me, I need to find a web server capable of running asp code. I don't want to install anything else on my development server.

rev

pippofaina
12-16-2003, 06:58 AM
Originally posted by revoemag@Dec 15 2003, 02:56 PM
You might try including a php file in asp.

In index.asp:
<!--#include file="/calendar.php"-->

This way asp code stays in the asp file and php code stays in the php file. Actual usage is still unknown to me, I need to find a web server capable of running asp code. I don't want to install anything else on my development server.

rev
In effect doesn't worK: it gives me "http 500 internal server error" if i put "<!--#include file="/calendar.php"-->" in an asp page.

<_<

pippofaina
12-16-2003, 07:02 AM
I have another answer: assuming that i don't want event in my calendar, what are the necessary files to load calendar?

demo.php
escal.php
calstyledefault.css

right now is correct?

i wanna create an EMPTY .asp page where to put my calendar.

what part of php code from which file (demo, escal) i must copy on my empty .asp page?

now it must be simple....

thanx B)

Brian
12-16-2003, 10:04 AM
If all you want to show is an empty calendar then escal.php and calstyledefault.css are the only two files you need. Just make sure you link to the CSS file in the header of your web page.

revoemag
12-16-2003, 11:46 AM
In the line:
<!--#include file="/calendar.php"-->
make sure that the filename calendar.php corresponds to whatever you call the escalendar file on your site.

For instance, if you just want an empty calendar, maybe put
<!--#include file="/escal.php"-->

or if you want to use the demo file, use:
<!--#include file="/demo.php"-->

Of course, you would probably not be able to get the demo file to work as is, since it adds html tags that really shouldn't be declared twice (such ash <html>, <head>, & <body>;



Papa,

I think this is good justification for breaking the program into functions (eg, display function, sql function, readfile function, ...).

rev

pippofaina
12-16-2003, 12:36 PM
Hi guys, after some work i made 2 tries:

www.usbtavernerio.it/escalendar/demoasp.asp

and

www.usbtavernerio.it/escalendar/provacalendario.asp

None of these works.

Thanx for the help, i'm waiting for a friend of mine help but i think he couldn't solve the problem too.

Thanx a lot for all your helps, the script looks great but i can't use it.... :(

Bye bye

PF

revoemag
12-16-2003, 01:54 PM
I will continue to work on the problem. I'm am very interested in being able to mix asp and php code. I will send you a personal message if and when I get it worked out. I think I'm getting close.

Also, let us know if you get it working yourself.

rev

pippofaina
12-18-2003, 09:46 AM
Hi guys, yes again me! <_<

No news from my "expert" friend, but i'm trying to avoid the problem.

I've created my www.usbtavernerio.it/escalendar/demoprova.php file and the calendar seems to be ok. But it works only with ALL months except January.....The page is not displayed correctly, even if u select with the mouse the text u see on the left corner there is january..... Suggestions? :blink:

Other question: do u remembre i wanted to put escalendar in a .asp file because i had an application to be run? Ok, this application requires this string

<!-- #include virtual="../visubox/box.asp" -->


to be runned. When u check the www.usbtavernerio.it/escalendar/demoprova.php page u see nothing under the "VISUBOX CHAT" .gif . Have u some suggestions?

U can see the correct asp application running in my homepage www.usbtavernerio.it.

As usual, thanx in advance! ;)

PF

revoemag
12-18-2003, 10:50 AM
The string
<!-- #include virtual="../visubox/box.asp" -->

is an asp statement which will not work in a php file. You will probably need to substitute it with
include("../visubox/box.asp);

in php to put that code in there.

According to the php manual, when you include a file, it drops out of php parsing and back into "html-mode" which is why you have to put the php open and close tags (<?php ?>) in the included file (assuming the included file is a php script as well). That being the case, I think that this would work so long as you put the correct asp open and close tags (<% ... %>, i think).

let me know if this works.

I will be installing IIS on my server and testing asp and php code.

I should have some answers later today.

rev

pippofaina
12-19-2003, 07:13 AM
Hi guys! :lol:

I've solved the problem using IFRAMES

U can check code at www.usbtavernerio.it/indexprova.php

Bye guys, and thanks a lot to all of you for your help

PF