1.

Solve : Need help creating a bat file?

Answer»

Hi
I have multiple php files all containing the FOLLOWING string of text in the code
I need a bat file that will scan the php files for the SPECIFIED text string and place an incrementing number in front of the .html bit. Is it possible?

ie


and so on

Any help greatly appreciated

OS is Windows 7 Ultimate 64bitI'm not sure what you're going for here, but why not just use a loop in the PHP? Something like this:

Code: [Select]<?php
$maxinclude=10;
for($i=1;$i<$maxinclude;$i++)
{
include($i.".html");


}
?>Thanks for the quick reply but it doesn't help my situation.
I have an index file on my website which contains a table with 5000+ links to individual games. The website has a 3 column layout and the game details display only in the middle div with the 2 side divs staying static throughout. When i click the link in the table it calls the php file relating to the game which in turn calls the HTML file and displays that games INFORMATION in the middle div, see below for snippets of code from the index file and php file

Index file



[/url]

0001 - Electroplankton
2006
Japan
Music
03/12/2010 16:15:28

Details[/url] <----- Link to PHP file




PHP file called from index









<------- the call to the html file. This number i need to increment.










The HTML file that's called is just standard table layout with text and images.

Your code displays all the HTML files one after the other which makes the PAGE huge as there are 5000+ individual HTML files each containg info for 1 game. I need to just display one HTML page at a time.

So i have a template for the php file, part of which you can see above, i need some way to automatically increment the statement by a value of one.

Alternatively a piece of php code that will call a HTML file with the same filename as the php file. So say the php file is named 208.php is there code i can insert which would look for a HTML file with the same name (208.html)

Sorry if this is confusing but I'm not an expert at php scripting or HTML , very much a try it and see kind of person Quote

Alternatively a piece of php code that will call a HTML file with the same filename as the php file. So say the php file is named 208.php is there code i can insert which would look for a HTML file with the same name (208.html)

Code: [Select]<?php
include(basename(__FILE__)."html");
?>
Thanks again, for reply. I pasted your code into my php file but get this error when i use Wampserver to run the script.

Warning: include(208.phphtml) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\ds\current\details\208.php on line 42

Warning: include() [function.include]: Failed opening '208.phphtml' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\ds\current\details\208.php on line 42

As you can see its now trying to call 208.phphtml how do i get it to drop the php in the extension?sorry, my mistake, turns out that the basename function doesn't return the basename. haha.

Code: [Select]include(basename(__FILE__,".php") . ".html");You are a star that works a treat, saved me so much manual editing!
I owe you a drink


Discussion

No Comment Found