Pavlos1316 Posted July 29, 2008 Share Posted July 29, 2008 Hi all I have this column code (from my table): <th scope="col" width="250"><emptyempty> </th> and I want to call (where emptyempty is) my date&time.php. Any ideas how to do that? Quote Link to comment https://forums.phpfreaks.com/topic/117136-call-function/ Share on other sites More sharing options...
MasterACE14 Posted July 29, 2008 Share Posted July 29, 2008 I hope I understand you correctly. date&time.php is a file? or do you want the actual date and time, as in using the time and date functions? <th scope="col" width="250"><?php include("date&time.php"); ?> </th> Quote Link to comment https://forums.phpfreaks.com/topic/117136-call-function/#findComment-602474 Share on other sites More sharing options...
scottybwoy Posted July 29, 2008 Share Posted July 29, 2008 give your page a .php extension and replace <emptyempty> with <?php include(date&time.php); ?> But really you shouldn't use & in your file name and it would be better to have a file that gets all your data for your page at the top, and then just use <?=$var?> wherever you want your data. Also as masterAce14 says, you can probably just get away with using the date function if that's what you want. Good luck Quote Link to comment https://forums.phpfreaks.com/topic/117136-call-function/#findComment-602475 Share on other sites More sharing options...
Pavlos1316 Posted July 29, 2008 Author Share Posted July 29, 2008 date&time.php was ex name but that file includes time & date function. and i want to call it in a column inside my top.html....... if possible. Cannot change top.html cause then I have to change a lot of things. Exept if there is an easy php script to display my own time and date in real time. Oh and <?php include ("");?> doesn't work!!! Quote Link to comment https://forums.phpfreaks.com/topic/117136-call-function/#findComment-602479 Share on other sites More sharing options...
wildteen88 Posted July 29, 2008 Share Posted July 29, 2008 You can only use PHP code within .php files, not .html files. However if you have access to your servers configuration, then you can configure the server so it parses .html files as PHP. If not, then there is no other option to have php code running in .html files. If you are concerned with having to change all your links from path/file.html to path/file.php then don't worry, you can use mod_rewrite. This option will save you from having to change your links, here is an example: RewriteRule ^(.*)\.html$ $1.php [L] With the above any request for a file called filename.html will call filename.php instead. Quote Link to comment https://forums.phpfreaks.com/topic/117136-call-function/#findComment-602928 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.