| | I want to change an include tag (include menu.htm) to include menu.php on all my pages on my website. Is there any fast way to do this, or do I have to edit all of my pages manually? |
|
|
QUOTE(Amezis @ Aug 19 2005, 06:08 AM) I want to change an include tag (include menu.htm) to include menu.php on all my pages on my website. Is there any fast way to do this, or do I have to edit all of my pages manually? I don't think there is method to change it at once. You have to change htm to php in every page yhat u uses menu.
Ok... I think I'll change everything that is included then... like the footer etc, maybe i'll need to have it in PHP later... Thanks for the info anyway...
Well, if you are wanting menu.htm to function as a PHP script (without manually changing everything), you could add this to .htaccess:
CODE AddType application/x-httpd-php .htm That way you don't have to change everything that references it to menu.php (as that can get tiring if you have many files). Hope that helped you.
Umm I think i'll change everything anyway... But thank you anyway.
When you click control + find and open up your "Find and Replace" dialog box, you have a section called "find in:" where you can select from various destinations, including: "current document", "selected text", "open documents" (last one depending on the version i think), and: "folder... (browse)" (among others). Here you select the folder which you want to search. Then you have the "search" section which you set to "code" (it also has the value for searching "text" in the document(s), only text but no html nor other kind of code, and "specific tag", which can for example, remove desired atributes from any given tag). Then you have the "find" text box, where you type what you want to replace, example "<?php include ("menu.htm"); ?>" and the "replace" text box, which you could set to: ""<?php include ("menu.php"); ?>". Yes, some times dreamweaver does more that what you want with your code, it leaves garbage in it, but in cases like this, it could save you a looooooooooot of work
I was going to say, if you have Dreamweaver, use find and replace. But if you don't...well, notepad has one, but you can't edit multiple files at once, so I don't know how else to help you...Sorry!
QUOTE(arboc7 @ Sep 8 2005, 12:23 PM) I was going to say, if you have Dreamweaver, use find and replace. But if you don't...well, notepad has one, but you can't edit multiple files at once, so I don't know how else to help you...Sorry! There are plenty of text-based HTML editors that do allow multiple file search and replace though. Get yourself one and it'll be done in a second. QUOTE(Tyssen @ Sep 7 2005, 08:49 PM) There are plenty of text-based HTML editors that do allow multiple file search and replace though. Get yourself one and it'll be done in a second. Ive used Crimson Editor, the only editor i know. And as i dont have it installed right now on this machine i couldnt say if it can search multiple files, but i believe it can. And its freeware! But its only for windows i think. Could you point out more of those editors? Latest Entries
If you're on a mac box, bbedit is the answer to every text based problem (well the ones that you couldn't be bothered learning PERL for, anyway). Unfortunately, you problably aren't on a mac.
My personal favourite is SciTE on win/linux. CrimsonEdit is good too, but really it's just a KATE imitation. I'm not sure if either of these do multiple-file search and replace, though, and I can't check (short of installing X11 on this mac and then SciTE, but i'm feeling lazy right now). Of course, if you felt like using PHP for this job, you could do something like a) read all filenames into an array, using opendir, readdir, et. al. c) do $new_string = preg_replace ("/include\s+?(\s+?'menu.htm'\s+?);/i", "/include ('menu.php');/", $StringWithTheFileInIt);. That scary-lookin thing just looks through $StringWithTheFileInIt, and replaces the old text with the new. The \s+? are to allow for any whitespace you may or may not have put in. d) overwrite the old file with the contents of $new_string, using fopen ( $filename, 'w' ). e) rinse, lather, repeat until done. Since you're using menu.php, i'm assuming that you know what most of that means :| If you do do this - i recommend you back up your stuff first in case you make a mistake and things go horribly wrong. I know the true pain of accidentally overwriting 10mb of text files with the string 'hello world'...... not cool.
Similar Topics
Keywords : changing, include, tag, pages
HOW? (20) I create certain pages for my web-site, and I would like to protect them that no one can hack or see how? (10) Hello, now this may be a stupid question but i'm very new to php so i need some help. what Please help me im stuck ;-( (5) Hi, i have been working with a wap forum script, translating from russian and fixing errors etc.. I need a way to set hidden input values to the new window. (3) I have 2 main pages Page A(events_locked.php) and Page B(add_attendance.php). Both are php files. PHP pages permission on Apache Server (1) Hello, I want to know what permissions for PHP pages should be given on Apache web server so that (1) suppose i have a page, page.php?part=1 there i have some text fields. user will give input, but Nice tutorial (5) This is a really good tutorial on making php pages that normally appear as (6) We're doing a "Mock" e-commerce site for our project in Web Development and I was wondering how (9) This isn't really that urgent but I was wondering, I read somewhere that you can configure you (4) I would like to know how and where to put the code that would block certain pages so people could (2) just wondering if there is a easy safe way to secure some webpages. i have a payment facility on my Access the same class instance over multiple pages (1) Hey everyone. I am having some trouble accessing the same php class instance in more that one page. changing a sites news using MySQL and PHP (3) Hey everyone. It appears to me that everyone really know what they are doing in this forum and im a ?? (9) I know its possible to put many pages inside 1 file. But how? Lets say you have a guestbook with (3) Is there a way to have php act as an iframe? I dont want to have to change every single page when i Looking for changing, include, tag, pages
|
|
![]() Changing Include Tag On All Pages |
| ADD REPLY / Got an Opinion! | Remove these ADs! | RAPID SEARCH! | Free Web Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute more info. to help others. Ask your Doubts & Queries to get answers, So that "Together We can help others!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|