Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-06-2009, 11:42 PM Using HTML in PHP
Novice Talker

Posts: 7
Name: jordan
Trades: 0
I'm pretty new to PHP and I can't find a answer for what I woud believe to be a easy question. I've tried so many things but cannot get it to work. I wrote a layout using XHTML and CSS and I want to add a PHP based gallery that I'll be making to one of the pages.

Is there a way I could either write the script in a seperate PHP file and attach it to the .html file with some code or just copy all my coding and move it into a PHP file and just add it in through there.

This is really bugging me and if someone could give me a answer I'd really appreciate it.
iMod0711 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-06-2009, 11:49 PM Re: Using HTML in PHP
Novice Talker

Posts: 7
Name: jordan
Trades: 0
I apologize, I found my answer. Like I said it was simple and just plain stupid. I forgot to delete the <html></html> when making it a .php =\.
iMod0711 is offline
Reply With Quote
View Public Profile
 
Old 03-06-2009, 11:50 PM Re: Using HTML in PHP
Knight13's Avatar
Defies a Status

Posts: 10,289
Name: Knight13
Location: Cleveland, Ohio
Trades: 0
You can add the php code directly into the html code.
sorry i did not pay attention when you said .html file.

Last edited by Knight13; 03-06-2009 at 11:55 PM..
Knight13 is offline
Reply With Quote
View Public Profile
 
Old 03-06-2009, 11:54 PM Re: Using HTML in PHP
Novice Talker

Posts: 7
Name: jordan
Trades: 0
I know I already solved this problem but I just wanna ask Knight a question. Wouldn't adding the php code into my html code mean I would have to edit my .htaccess file to allow this? I'm making this layout for a friend so I want it to be as simple as possible for him, since he isn't the best with coding.
iMod0711 is offline
Reply With Quote
View Public Profile
 
Old 03-07-2009, 12:24 AM Re: Using HTML in PHP
Knight13's Avatar
Defies a Status

Posts: 10,289
Name: Knight13
Location: Cleveland, Ohio
Trades: 0
When i read your post i did not pay attention to you saying you could not put php script in a .html file i thought you meant that you wanted to put php inside of html i did not realize you were not able to put php in a .html file, but you are right just put the php and html in a .php file and it will work. sorry for the misunderstanding my fault.
Knight13 is offline
Reply With Quote
View Public Profile
 
Old 03-10-2009, 09:56 AM Re: Using HTML in PHP
Skilled Talker

Posts: 52
Name: Morten
Trades: 0
actually if you wanted you could just:

<html>

<head>
<title>TITLE</title>
</head>

<body>

<?php
echo "lalalal";
?>

</body>

</html>



and save the file as "something.php"

you COULD do that, but that would probably not be professional - but your new so why not
__________________
- Do Nothing!
- Get Nothing!

Please login or register to view this content. Registration is FREE
Rotco88 is offline
Reply With Quote
View Public Profile
 
Old 03-10-2009, 09:59 AM Re: Using HTML in PHP
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And the problem with using that kind of code would be?

because there is going to be thousands of programmers who will vehemently disagree with your definition of professional programming!!!
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-10-2009, 10:02 AM Re: Using HTML in PHP
Skilled Talker

Posts: 52
Name: Morten
Trades: 0
Quote:
Originally Posted by chrishirst View Post
And the problem with using that kind of code would be?

because there is going to be thousands of programmers who will vehemently disagree with your definition of professional programming!!!
Sure - if you say so - LoL!

I don't care what "thousands of programmers" think of my definition to be honest!

So you think the code is okay then? And the way to do it?
__________________
- Do Nothing!
- Get Nothing!

Please login or register to view this content. Registration is FREE
Rotco88 is offline
Reply With Quote
View Public Profile
 
Old 03-10-2009, 10:07 AM Re: Using HTML in PHP
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
So you think the code is okay then? And the way to do it?
Of course it is.

Why do you think it isn't perfectly okay?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-10-2009, 10:14 AM Re: Using HTML in PHP
Skilled Talker

Posts: 52
Name: Morten
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Of course it is.

Why do you think it isn't perfectly okay?
To be honest, I don't want to explain why that's not okay for ME! It's okay for you - great. I'm proud of you, no doubt about that.

I wouldnt do it like that, end of story, if he's gonna use this method then do it... Why would I even care? I'm just trying to help some people, but ****, your commenting everything - and for what reason?
__________________
- Do Nothing!
- Get Nothing!

Please login or register to view this content. Registration is FREE
Rotco88 is offline
Reply With Quote
View Public Profile
 
Old 03-10-2009, 02:22 PM Re: Using HTML in PHP
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
I think Chris is just pointing out that if the situation calls for it, there is nothing unprofessional about it.

You should be careful about what you claim is wrong or unprofessional. If you haven't anticipated all of the circumstances, you may find yourself doing it one day.

Just my opinion.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 03-10-2009 at 02:28 PM..
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-10-2009, 02:40 PM Re: Using HTML in PHP
Skilled Talker

Posts: 52
Name: Morten
Trades: 0
I'm pretty sure I'm not gonna do this some day...

Not to be negative, but I have programmed a lot of scripts, and never did I do that. Well Like I care anyway.
__________________
- Do Nothing!
- Get Nothing!

Please login or register to view this content. Registration is FREE
Rotco88 is offline
Reply With Quote
View Public Profile
 
Old 03-11-2009, 12:22 PM Re: Using HTML in PHP
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
I think the most professional way to do this, is the fastest (programming and processing wise).
For example:
PHP Code:
<?php
include ('init.inc.php'); // Start the file. This imports everything and does everything to run the page.
$page->run();
include (
'end.inc.php');// Do a little house keeping. Finish everything up.
?>
Could be both professional (Clean coding, in theory easy to update) and unprofessional (it could take a long time to process).
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-14-2009, 11:56 AM Re: Using HTML in PHP
Skilled Talker

Posts: 85
Name: Ilyes Rhouma
Trades: 0
Quote:
Originally Posted by iMod0711 View Post
Wouldn't adding the php code into my html code mean I would have to edit my .htaccess file to allow this?
Yes, of course.

Simply in a .htaccess file in the same directoryadd a line
Code:
AddType application/x-httpd-php .html
Quote:
Originally Posted by iMod0711 View Post
I forgot to delete the <html></html> when making it a .php =\.
I don't understand, you can add <html></html> in a .php file !

You maybe don't know that between the two <?php ?> you can put html script but only like that:
PHP Code:
echo "and the script here"
This may help.

Note: I don't care if is proffessional or not, but it is
__________________
Want a cheap and custom programmer or writer ?
Please login or register to view this content. Registration is FREE

Are you
Please login or register to view this content. Registration is FREE
? Start
Please login or register to view this content. Registration is FREE
free and earning money !
Please login or register to view this content. Registration is FREE
Ilyes is offline
Reply With Quote
View Public Profile Visit Ilyes's homepage!
 
Old 03-14-2009, 06:09 PM Re: Using HTML in PHP
The-Pixel's Avatar
I <3 Pixel's

Posts: 888
Name: Lindi Wheaton
Location: In Photoshop
Trades: 0
Quote:
Originally Posted by iMod0711 View Post
I apologize, I found my answer. Like I said it was simple and just plain stupid. I forgot to delete the <html></html> when making it a .php =\.
I've done the same but not with PHP / HTML. I've looked a problem for so long and thought so hard about it I missed the obvious. Best of luck!
__________________
The-Pixel

Please login or register to view this content. Registration is FREE
:: iPhone Apps, Pre-Made Templates, Widgets, Menus, etc.

Please login or register to view this content. Registration is FREE
:: Web Design / Development, Business Cards, Logo Designs, etc.
The-Pixel is offline
Reply With Quote
View Public Profile Visit The-Pixel's homepage!
 
Reply     « Reply to Using HTML in PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46370 seconds with 12 queries