Hello and welcome to the Webmasters Forums!. This is the best place to get webmasters resources for free. Get $2 for free today, read more - Make your payment today. Download premium and professional templates for free. Get free web hosting without ads, read more. You can get lot more by simply join with this forum. To gain full access to the forums you must sign up for a free account.


Post Reply  Post Thread 

How to insert codes in a php file?

Post Bank
Posting Manager
******

Posts: 995
Group: Forum Team
Joined: Sep 2006
Status: Online
Make money from now. You can make money just for posting on this forum. Every discussions on this community gives you more money. $2 minimum payout. So get your payment today, SignIn with this forum.

Signin to Remove this Post

Cedik
Moderator
*****


Posts: 424
Group: Moderators
Joined: Aug 2007
Status: Away
Reputation: 2
Points: 575 (Donate)
Post: #1

How to insert codes in a php file?


A friend of mine inserted banners and google ads directly in the php files so he managed to place google ads in very unusual places.
I tried to do that too but it gave me some errors.
How exactly do you do it?
Is there some trick that I don't know?


MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
02-11-2007 07:49 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #2

RE: How to insert codes in a php file?


Cedik Wrote:
A friend of mine inserted banners and google ads directly in the php files so he managed to place google ads in very unusual places.
I tried to do that too but it gave me some errors.
How exactly do you do it?
Is there some trick that I don't know?


Am not clear about your question. But am giving some general tips about .php and HTML with the files.


The execution of a php files done in part by parts. Those parts of a php file enclosed under <?php .... ?> is going to execute. So you can put the normal HTML codes on the .php files with out restriction outside the php code.


Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
02-11-2007 07:53 AM
Find all posts by this user Quote this message in a reply
Cedik
Moderator
*****


Posts: 424
Group: Moderators
Joined: Aug 2007
Status: Away
Reputation: 2
Points: 575 (Donate)
Post: #3

RE: How to insert codes in a php file?


So, I'll open, for example, the theme.php file and add the new html or javascript code after the ?> part? or before the <? part ?
But won't this affect the php file?


MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
04-11-2007 12:57 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #4

Outside PHP Tags - How tags are interpreted by PHP Parser


Cedik Wrote:
So, I'll open, for example, the theme.php file and add the new html or javascript code after the ?> part? or before the <? part ?
But won't this affect the php file?


Yes...

That parts remains as the same html file..

Im going to explain here the processing of a PHP file when clients request it. -

On the invocation of a php file request, the server settings invokes the php parser to fetch that file and interpret the full file line by line. They only compiles those parts enclosed within <? ---- ?> the other parts directly send to the clients with our executing that part. So the client gets the all parts outside <? ..... ?> intact, without any change.

So you can put any thing out side the PHP tags.


Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
05-11-2007 04:03 PM
Find all posts by this user Quote this message in a reply
Cedik
Moderator
*****


Posts: 424
Group: Moderators
Joined: Aug 2007
Status: Away
Reputation: 2
Points: 575 (Donate)
Post: #5

RE: Outside PHP Tags - How tags are interpreted by PHP Parser


ivenms Wrote:
Yes...

That parts remains as the same html file..

Im going to explain here the processing of a PHP file when clients request it. -

On the invocation of a php file request, the server settings invokes the php parser to fetch that file and interpret the full file line by line. They only compiles those parts enclosed within <? ---- ?> the other parts directly send to the clients with our executing that part. So the client gets the all parts outside <? ..... ?> intact, without any change.

So you can put any thing out side the PHP tags.


But it didn't work for me. Sad
I put the code outside the <? part and nothing :|
It was an ad-sense code and no ads appeared on my page...


MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
05-11-2007 08:39 PM
Visit this user's website Find all posts by this user Quote this message in a reply
shadav
The Forgotten One
******


Posts: 391
Group: Super Moderators
Joined: Oct 2006
Status: Online
Reputation: 2
Points: 1058 (Donate)
Post: #6

RE: How to insert codes in a php file?


create a new file called adsense.php within the file you are wanting it to display try using

PHP Code:
<?php
include "http://www.yoursite.com/adsense.php";
?>

or

PHP Code:
<?php
include "/path/to/your/file/adsense.php";
?>

For example:


<?php
include "/home/shadav/public_html/sidebar.inc";
?>


Foamy Fanatics Fan Site
Webmasters Resource Forum Photos For Sale
05-11-2007 11:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Cedik
Moderator
*****


Posts: 424
Group: Moderators
Joined: Aug 2007
Status: Away
Reputation: 2
Points: 575 (Donate)
Post: #7

RE: How to insert codes in a php file?


Well, I understood that but now comes the though part...
How do I create a php adsense file? Big Grin
Does google adsense generate a php code too, not just a html one?


MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
06-11-2007 04:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #8

RE: How to insert codes in a php file?


Cedik Wrote:
But it didn't work for me. Sad
I put the code outside the <? part and nothing :|
It was an ad-sense code and no ads appeared on my page...


Are you using the same code given by adsense?.. Just put the code in the file as HTML code, nothing else. Also don't try to put code with the help of advanced HTML editors like frontpage or dreamviewer. Since we are dealing with page codes, they can generate unwanted codes for the page, which generates errors. Use notepad for coding.


Cedik Wrote:
Well, I understood that but now comes the though part...
How do I create a php adsense file? Big Grin
Does google adsense generate a php code too, not just a html one?


Very simple..

Open your notepad. Name the file as "adsense.php".

Then put the adsense code int the file as content and save it. Then upload it into your site. Very simple. That is not though and it is the simplest part. The main advantage of using a separate file for ads is that you can change the entire site's ads by changing a simple file.


Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
06-11-2007 04:49 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:

Forum Jump:

Sign In to Remove Ads

Download 1000's of web templates. Unlimited access!
World's Best Web Hosting
Website of the Month

Create-a-Page for Free
SOTM June 2008


Accepting Submissions
for July 2008
Resources

Recommended Sites:



Visit our Sponsors!

Current time: 29-08-2008, 11:32 AM


Copyright © 2002-2008 MyBB Group
Powered By MyBB