joseph Posted October 16, 2007 Share Posted October 16, 2007 How do we call a certain function from another webpage (function.html) to show in this particular page (index.html)? For example if I have this in my function.html <a href="http://sitename.com">sitename</a> and I would like to call that function to show in the index.html without using iframes. Thanks. Quote Link to comment Share on other sites More sharing options...
fenway Posted October 16, 2007 Share Posted October 16, 2007 That's not a function. Quote Link to comment Share on other sites More sharing options...
jason_kraft Posted October 16, 2007 Share Posted October 16, 2007 You mean you just want to include function.html in index.html? i'm assuming you have already tried <?php include("filename.html"); ?> Are you running php, what server are you on? Quote Link to comment Share on other sites More sharing options...
joseph Posted October 16, 2007 Author Share Posted October 16, 2007 I'm testing my site locally on a wamp server. I have a links.php having: <?php function topnav() { echo' <a href="...."></a> } '; ?> It does not seem to work if I call it in index.php: <?php topnav(); ?> I want to call the topnav() in index.php so that I don't to edit the links everytime I add a new webpage. @jason_kraft: I also tried <?php include("filename.php"); ?> however it gives me an error Warning: include() [function.include]: URL file-access is disabled in the server configuration... Does javascript has something like this? I might need it in javascript codes because my website is currently in .html extensions. Quote Link to comment Share on other sites More sharing options...
fenway Posted October 16, 2007 Share Posted October 16, 2007 JavaScript and PHP have nothing to do with one another. Quote Link to comment Share on other sites More sharing options...
jason_kraft Posted October 16, 2007 Share Posted October 16, 2007 i'm assuming you are a new programmer? but yeah hey try including a .js file with all your functions and linking it in your .html file so you will have a "functions.js" file with contents function functionname() { ... } and your "index.html" file just link the .js file in the head section <head> <title>Page Title</title> ... <script type="text/javascript" src="functions.js"></script> </head> but i recognize that this is not a php issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.