|
|
Author |
Thread |
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-22-2001 22:19
Hi guys, not sure if I should be here or the JavaScript forum, but I'll start here.
I have a page with a four month calendar on it. When you click on a date, it will pop a new window with the info pertaining to that date. Do you guys have any easier ways to handle this than coding 50 or so HTML popup windows?
I am in the process of switching hosts, so I can't show you a page at this point, but if you think you need to see it, let me know and I will post it after I have everything switched over. I'm allowed to use PHP with my new host, and probably know just enough to do the necessary coding if you suggest that way to go, but I don't have a database, so I'm not quite sure what good the PHP is without it in this case.
I would be appreciative of any suggestions.
Thanks
|
Boudga
Maniac (V) Mad Scientist
From: Jacks raging bile duct.... Insane since: Mar 2000
|
posted 03-22-2001 22:23
I have a pretty good CGI calendar you can have if you want it.
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-22-2001 22:39
Thanks Boudga, but I'm not sure what a CGI calendar does. I've switched the files for this page over to my new host so everyone can see what I'm trying to do, If you think it's something I could use in this case, I'd be greatful. The only calendar date on the page that has a working link is May 4th.
Here's the link
http://www.martysdesigns.com/greatdane/area.html
Thanks
|
la'dsasha
Neurotic (0) Inmate Newly admitted
|
posted 03-23-2001 02:04
this probably should be in the javascript forum.
i use a lot of pop-up windows for pages with lots of images on them.
heres the function to put in the header:
<script language="javascript">
<!--
//pop-up window function
function newwin(theURL,winName,features) {
window.open(theURL,winName,features);
return false;
}
-->
</script>
then all i do is make up the link to the page i want to show up in the little window:
<a href="url" onclick="return newwin('url','winname','width=438,height=295')">date</a>
whats nice about this particular script is that it is backwards compatable for those who dont have javascript or have it disabled.
------
Hell hath no fury like a woman scorned
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-23-2001 03:37
Thanks la'dsasha, I'll put that code to good use, but what I was actually asking about was a way to dynamically write the html code for the popup window, so I didn't have to code all 50 of them as separate files and keep them on the server.
|
mr.maX
Maniac (V) Mad Scientist
From: Belgrade, Serbia Insane since: Sep 2000
|
posted 03-23-2001 09:08
Store all entries in database, create a PHP page that will accept date parameter and fetch appropriate entry from database and simply open that PHP page by passing date parameter (i.e. "show.php?date=23/3/01");
|
bitdamaged
Maniac (V) Mad Scientist
From: 100101010011 <-- right about here Insane since: Mar 2000
|
posted 03-23-2001 19:26
What you need isn't so much code to write the popups but to create the calender with the appropriate links.
Max is right this would be much easier and more efficient on the server-side though it could be done with JS
a sample of the calender code would help.
Walking the Earth like Kane
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-23-2001 21:51
I would have gone that way from the start Mr. Max, but the only database I have access to is on my own pc. I don't have the bucks to afford it with my host. I was wondering if there was another way, without the database.
Sorry Bitdamaged, there is no calendar code, it's all html and <a> tags so far.
Thanks guys
|
mr.maX
Maniac (V) Mad Scientist
From: Belgrade, Serbia Insane since: Sep 2000
|
posted 03-23-2001 22:47
You can use flat files instead...
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-23-2001 23:15
I was going to mention that in my last post, but didn't want to sound ignorant if that wasn't the proper use for them. I've read many posts here that mention flat text files, but have no idea of what they are, or how to use them. Any guidance would be appreciated.
[This message has been edited by butcher (edited 03-23-2001).]
|
bitdamaged
Maniac (V) Mad Scientist
From: 100101010011 <-- right about here Insane since: Mar 2000
|
posted 03-24-2001 03:55
Nope the HTML for the calender is the code I'd need, what you need is a more efficient way of writing them out with the appropriate popups, this can be done on the server with PHP, perl whatever or done even with JS.
Can you run PHP on your new host?
Flat files are just that, text files but they can be used instead of a database it's just tougher since you need to add some parsing to get the information into your script properly.
Walking the Earth like Kane
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-24-2001 20:29
Yes, I can use PHP with my new host, it's one of the reasons I switched. As for the code on the calendar, if all else failed, I was just going to throw a JS function for the popup window in the head (one like la'dsasha was nice enough to offer), and call it with an onClick event.
I know how to code calls to a database in PHP, but I don't know how to do it with flat text files at all. I don't even know if there's any particular way to set up the text file to use it that way. I would be thankful for any links, pointers, or good hard shoves in the right direction.
Thanks
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-26-2001 01:27
O.K.
I've got the flat file database thing taken care of (I think), and now I need to know how pass the date info that the user clicks on, from the page, to the server. I know this has got to be simple, but without a form, I'm not sure how to do it.
I know I need to add some code to handle the date passed from the web page, but here is my PHP code as it stands now:
<?
$filename = "show_info.csv";
$fp = @fopen($filename, "r") or die("Couldn't open file");
while($row = @fgetcsv($fp, 1000, "
|
bitdamaged
Maniac (V) Mad Scientist
From: 100101010011 <-- right about here Insane since: Mar 2000
|
posted 03-26-2001 21:00
Okay this isn't a big deal, instead of a form we'll just fake one.
what you want to do is in the call for the page add the date to the querystring.
you can do this in the JS for the popup or in the link itself
basically <a href="mypage.php?id_date=[INSERT THE DATE HERE]">
you can add even more variables by seperating them by an ampersand ("&").
If you put this in the JS you could do it with a function like this.
function openWin(date) {
URL = 'mypage.php?' + date;
// Cleans things up
escape(URL);
mywin = window.open(URL,'','height=300, width=200,resizable=no,titlebar=yes,menubar=no,status=no,scrollbars=no,toolbars=no,location=no');
}
Then in your calender you need something like this:
<a href="javascript penWin('03262001')"> 03/26/2001</a>
Walking the Earth like Kane
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-27-2001 03:20
Thanks Bitdamaged!!!
Your <a href="mypage.php?id_date=[INSERT THE DATE HERE]"> code worked like a charm. I reworked my PHP script to handle it and it works fine.
Of course I have another problem for you to help me with, if you would be so kind. I really want this in a smaller popup window, and I just couldn't seem to get the,
<a href="javascript openWin('03262001')"> 03/26/2001</a> to work properly. I'm sure whatever it is, you expected me to know it, but for some reason JavaScript confounds the hell out of me.
If you would be kind enough to spell out the <a href> code a little more idiot proof for me I would be greatful.
Thanks again for helping me through another learning experience. Before I started this thread, I had no idea you could use a simple text file like a database, or how to pass variables with the url.
Man I love learning this stuff!!
Thanks again
|
mr.maX
Maniac (V) Mad Scientist
From: Belgrade, Serbia Insane since: Sep 2000
|
posted 03-27-2001 05:07
You should add ':' betwen word 'javascript' and function name, like this:
<A HREF="javascript:openWin('03262001')">03/26/2001</A>
|
bitdamaged
Maniac (V) Mad Scientist
From: 100101010011 <-- right about here Insane since: Mar 2000
|
posted 03-27-2001 19:41
Whoops heh silly slimies
Walking the Earth like Kane
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 03-27-2001 20:31
I'm not sure who's sillier, me or the slimies. I tried using <script> brackets in every conceivable way, with out ever thinking about why Bitdamaged put a slimie there.
Thanks to you both
|