How to write a php script to automate a task?



ASP.NET, Classic ASP, PHP, Ruby, Python, JSP
Jamie

PostFri Apr 27, 2012 12:22 pm


Rank: Advisor

Posts: 30
Joined: Thu Apr 12, 2012 12:02 am



Hi everyone,

I run a genealogy website that is mainly html, a few php pages, and a few java scripts i picked up for specific needs.
I dont know php or java. though i would like to pick a few things up.

I have a problem, a lengthy task manually, that i would like to automate.
I have about 300 images in a directory: images/arms/ and each image file name begins with a number followed by an underscore: e.g. 45_coatsofarms.png
I have a html file with text and in that text each image is mentioned with the number followed by a period: e.g. 45.
What i need to achieve is an image link directly after this text pointing to the correct file.

I know this can be done in php, but im not sure how to achieve it. Can someone offer some help?

Thanks
Ron F

PostFri Apr 27, 2012 1:31 pm


User avatar
Rank: Advisor

Posts: 41
Joined: Sun Mar 18, 2012 9:44 pm



I'm no expert but you might be able to do this in javascript, perhaps somehow parse the text, and auto insert the links?

Perhaps some of the Ninja wizards could lend a hand?
Mark73

PostMon Apr 30, 2012 1:18 pm


User avatar
Rank: Apprentice

Posts: 112
Joined: Sun Feb 26, 2012 11:44 am



Jamie,

do you have any more details? This is certainly do-able via PHP.

When you say you want to switch some text into links, does each number example "45." link to only ONE image?
ljepilo

PostTue May 22, 2012 9:59 am


Rank: Apprentice

Posts: 110
Joined: Mon May 21, 2012 7:51 am



Hi,

Try these steps...

1.Simple create a table like "images_upload",
2.In this table create a column name image
3. Put all the 300 images into this table.
4. Fetch all the value from the database put like that.
5. <a href="URL_<?=45_"File Name"?>" target="_blank">File Name</a>

I hope this helps
4 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest