| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/26/2005 07:58:35
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
--------------------------------------------------------------------------------
Hi,
I've heard its possible to do this but not sure how or even what direction to start looking in.
I basically am making a directory of adverts for companies and to make it fair I want all to appear every time but in different orders. I would like the layout to look as follows:
ABC Limited
Tel: 023 XXX XXX
www.ABC.com
XYZ Limited
Tel: 023 XXX XXX
www.XYZ.com
CBA Limited
Tel: 023 XXX XXX
www.CBA.com
ZYX Limited
Tel: 023 XXX XXX
www.ZYX.com
With fonts in same font as ret of site (but I think I can do this already)
and someone mentioned using a Java form but they did not know what function to use.
I managed to get a very basic one where it lists them all one above the other and Tel and web on same line as name but as soon as I start putting in <br> everything just disappears.
The guy I spoke to said he'd heard of a way where I can make a form and assign a tag to each box then get each box to display one of the items with no repeats or duplicates and when not enough items box remains empty. But he said he hasn't done it in a while and can't remember what code he used.
Can anyone firstly let me know if this is possible or if there is a better way and secondly if they could point me in the right direction that would be amazing.
Thanks,
David
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/26/2005 08:50:57
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline
|
What is you backend - Java, PHP, ASP, etc? This isn't that difficult in any of those languages but it's a matter of how you program it.
|
Thanks for using the forums at hotjoe.com |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/26/2005 09:28:07
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
Hi,
I am new to this and only used to HTML sites on Dreamweaver so the site I want to put it into has been created in HTML on Dreamweaver.
My host says they support Java and PHP but I'd heard that PHP is a lot more confusing than Java.
Thanks for helping by the way.
David
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/26/2005 10:13:23
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline
|
I guess it is a matter of opinion. Both Java and PHP have the capability to do what you want. I find it easier to build a decent system in Java but I'm somewhat biased - it is what I do for a living.
You basically want an advertisement rotator. Some of these switch an image, some do what you want and switch text. I'd encourage you to Google for some possible solutions. You will find them in both PHP and Java.
If you want to roll you own in Java you'll basically want a small chunk of code to do this. I would check the status of a cookie to see what the user has seen already. If there is no cookie then just show them a random one and set the cookie to say something like "startingIndex=3" so that you know where they started. Each time they visit you will increment the counter.
This is hardly perfect for a large scale environment (for example, what about adding and removing advertisements) but it would work.
|
Thanks for using the forums at hotjoe.com |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/26/2005 11:26:52
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
I have just searched Google but I don't think this is quite what i'm looking for as this will only display one image at a time. What I am trying to do is the same as the results on www.yell.com (search for example websdesign in Liverpool) where everytime you return to the list of companies they are in a different order.
Thanks
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/27/2005 13:18:20
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline
|
I'm sorry, I misunderstood the problem before. This is actually pretty simple in Java or PHP. Do you have the capability to run Java on your server?
I'd change your page to a JSP and have a simple bean to do the work of reading the appropriate information and put it out in HTML. It wouldn't be too bad at all.
|
Thanks for using the forums at hotjoe.com |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/27/2005 15:30:32
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
Hello,
Thanks very much for your help. My host says they support Java, Javascript (not sure on the difference but hey) and PHP4 version 4.2.2.
Do all browsers support Java?
Sorry, I'm not much of a techy. What's a bean?
Thanks,
David
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/27/2005 15:36:06
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline
|
No worries... the code you'll need is on the server side and has nothing directly to do with the browser. Basically a small chunk of code will run on the server, generate the HTML the way you want, and send it back to the browser.
If this is your only Java section then I'd recommend making it pretty simple. A single JSP (java server page) can handle all of this.
Basically you'll write your HTML the same as always. In the section that you want your random list you will write a little bit of Java to handle this. Where is the list stored - flat file, DB, just in code?
|
Thanks for using the forums at hotjoe.com |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/27/2005 16:18:47
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
The majority of my site will require this code as I am making a new directory where ever page will have different companies advertising.
I have not put the data in any list yet. What is the best way? I have the whole Macromedia Studio MX Suite but to be honest I only use Dreamweaver for HTML sites and then Flash for simple things. Naver made a database in my life but I think it might be best to this time. I am hoping to have around 10,000 adverts within the first 2 years split among 200 sub headings.
Will I be able to include a web address in the information as below
ABC Limited
Tel: 023 XXX XXX
Web: www.ABC.com
but with the web address being a hyperlink?
Many thanks,
David
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/27/2005 16:34:31
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline
|
If you have that many I'd really think that a database would be the best bet. Basically you'll include a small section of JSP on each page you'll want the advertisements. Maybe something like:
The only real pain for you would be to add this chunk of code to any of the pages you want.
In advertServer.jsp you would read from the database and output the HTML. This can be any valid HTML, including anchor (links) tags. This code would be a bit harder if you don't have DB experience but really isn't too bad. Does your host support any kind of DB such as MySQL or PostgreSQL?
|
Thanks for using the forums at hotjoe.com |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 10/27/2005 16:51:16
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
My server supports MySQL and they give me 10mb apparently.
So would I need to include a piece of code for each advert or just one on each page?
Thanks,
David
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 11/01/2005 14:02:28
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
Hi,
I have sorted, well am working on sorting my MySQL Database which I think I've now got to grips with. The only bit I'm having trouble with is what code to use to pick up the data from the different tables in the database and put it in a different random order in the webpage (HTML) each time the page is opened.
I have bought two Java Books, a O'Rielly one and the O'Rielly Cookbook but just by reading the indexes and contents page its not obvious to me where to even start.
I would really appreciate a little help if possible.
Many thanks,
David
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 11/04/2005 12:16:23
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline
|
Do you have a table structure laid out? That would be the first thing. Based on what you have so far I think it would look something like:
where:
site_name is simplye the name that gets displayed - i.e. "XYZ Limited"
telephone is just that. It is nullable which means that it is optional.
displayed_url would be something like "www.xyz.com".
actual_url may or may not be the same as displayed_url. For example, you may want the user to access a page within a site so actual_url might be www.xyz.com/some/page/some/where or something like that. Or you might want to be able to tell the destination site that you sent them there with a parameter like www.xyz.com/referred?daveyjones
Once you have the table in MySQL then it is time to write the JSP. Where are you at with all of this?
|
Thanks for using the forums at hotjoe.com |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 11/04/2005 13:45:45
|
daveyjones1979
Newbie
Joined: 10/26/2005 07:57:29
Messages: 8
Offline
|
Still just writing the tables. I was hoping I could have say 10 columns in the table but only 3 or 4 that get taken to the web page. Is this possible?
I have a really good book for MySQL which is helping me write a form which will automatically put all info into the database with just a review option so all I do is change from a N to a Y and the info goes live. All I need to do now is figure out how to get certain fields from my table to appear on my webpage so that each company which is advertising appears in a different random order each time the page is refreshed.
I just can't find anything anywhere that has helped with the Java coding other than this site. By the way, much appreciated!
Thanks,
|
|
|
 |
|
|