Results 1 to 10 of 10
-
13th Aug 2012, 04:29 PM #1OPMember
Use php include for certain div of the page
Hello,
I have this syntax:
Code:if ( $CountryCode == RS || $CountryCode == ME ) { require $_SERVER['DOCUMENT_ROOT']."/ads/et300x250rsTEST.html "; }
Code:if ( $CountryCode == RS || $CountryCode == ME ) { require $_SERVER['DOCUMENT_ROOT']."/ads/et300x250rsTEST.html#nameovDiv1"; }
Code:if ( $CountryCode == RS || $CountryCode == ME ) { require $_SERVER['DOCUMENT_ROOT']."/ads/et300x250rsTEST.html#nameovDiv2"; }
Code:if ( $CountryCode == RS || $CountryCode == ME ) { require $_SERVER['DOCUMENT_ROOT']."/ads/et300x250rsTEST.html#nameovDiv3"; }
Qusetion is - How to use php include to include just part of the page which is on mine server, so i have full control of it, i can add whatever code there too [et300x250rsTEST.html] ?
Thanksigordr Reviewed by igordr on . Use php include for certain div of the page Hello, I have this syntax: if ( $CountryCode == RS || $CountryCode == ME ) { require $_SERVER."/ads/et300x250rsTEST.html "; } Rating: 5
-
14th Aug 2012, 02:20 PM #2Respected Member
Without seeing the rest of the code it would be hard to say.
You will have to use javascript to turn the div back to display from none.
Are you writing the entire html from the php program? If not just add the javascript in html to display the div you want. How are you determining the country code?
-
14th Aug 2012, 11:54 PM #3OPMember
Hi mate, thanks for reply.
This is the full code:
Code:<?php //connect to db $con = mysql_connect('localhost', 'xxxxxxx_user', 'passss') or die(mysql_error()); mysql_select_db('xxxxxxx_base', $con); //Get the parameters if ($_GET["ip"]){ $ip = mysql_real_escape_string(trim($_GET["ip"]), $con); } else { $ip = getenv('REMOTE_ADDR'); } //Run the IP location query $ipQuery = mysql_query("SELECT * FROM `ip_group_city` where `ip_start` <= INET_ATON('$ip') order by ip_start desc limit 1;", $con); $ipData = mysql_fetch_array($ipQuery); $nbResults = (bool)mysql_num_rows($ipQuery); $CountryCode = $ipData['country_code']; if ( $CountryCode == RS || $CountryCode == ME ) { require $_SERVER['DOCUMENT_ROOT']."/ads/et300x250rsTEST.html"; } else if ( $CountryCode == HR || $CountryCode == BA ) { include $_SERVER['DOCUMENT_ROOT']."/ads/et300x250hr.html"; } else if ( $CountryCode == DE || $CountryCode == AU || $CountryCode == CH ) { include $_SERVER['DOCUMENT_ROOT']."/ads/sp300x250deAUch.html"; } else { include $_SERVER['DOCUMENT_ROOT']."/ads/300x250else.html"; } ?>
May you help me with that?
Thanks
-
15th Aug 2012, 01:47 AM #4Member
Or you could shorten it to
PHP Code:if (file_exists($_SERVER['DOCUMENT_ROOT']."/ads/et300x250".$CountryCode.".html")) {
include($_SERVER['DOCUMENT_ROOT']."/ads/et300x250".$CountryCode.".html");
} else {
include $_SERVER['DOCUMENT_ROOT']."/ads/300x250else.html";
}
-
15th Aug 2012, 12:33 PM #5OPMember
Thanks for reply bluefrogx!
May you help me with wrap all this into the function and call it, how code should look like?
Thanks a lot.
Igor
-
15th Aug 2012, 01:09 PM #6Member
This site is using a hacked database of W junction
Last edited by Gavo; 4th Jan 2015 at 02:03 PM.
-
15th Aug 2012, 02:26 PM #7OPMember
Gavo, your post is very interested, but where i may find and download GeoIP.dat and geoip.inc ?
Also, how i can use statements as
if ( $CountryCode == RS || $CountryCode == ME ) {
require $_SERVER['DOCUMENT_ROOT']."/ads/et300x250rsTEST.html";
}
else if ( $CountryCode == HR || $CountryCode == BA ) {
include $_SERVER['DOCUMENT_ROOT']."/ads/et300x250hr.html";
}
else if ( $CountryCode == DE || $CountryCode == AU || $CountryCode == CH ) {
include $_SERVER['DOCUMENT_ROOT']."/ads/sp300x250deAUch.html";
}
else {
include $_SERVER['DOCUMENT_ROOT']."/ads/300x250else.html";
}
Thanks
-
16th Aug 2012, 11:00 AM #8Member
This site is using a hacked database of W junction
Last edited by Gavo; 4th Jan 2015 at 02:03 PM.
-
25th Aug 2012, 05:24 PM #9Member
Hi,
I would say, change the page you are including to a php file too (as you probably already know, php can contain html or you can use php to echo it).
That way you don't even need an if statement in your main page, you just move those if statements to the page containing the ads, echo'ing the right div based on your "CountryCode" variable.
Good luck.
-
25th Aug 2012, 05:54 PM #10MemberWebsite's:
WarezRocker.info Share4U.org Imdb.WarezRocker.info DownTurko.org Host-Palace.com HeroTurko.promake functions for each ads,and call those ads function(country based);
like:
if ( $CountryCode == RS || $CountryCode == ME ) {
functionnameRSorME;
}
else if ( $CountryCode == HR || $CountryCode == BA ) {
functionnameHR;
}
else if ( $CountryCode == DE || $CountryCode == AU || $CountryCode == CH ) {
functionnameRSorME;
}
else {
functionname;
}
and add those ads in functions.if its not cleared to you,then maybe i can help but later.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Selling] Post Button (Include PSD)
By Samar in forum ServicesReplies: 0Last Post: 26th Aug 2012, 06:08 PM -
[Selling] 4 Website for Sale (include 2 PR2 + 1 PR1)
By freehealthylife.com in forum Completed TransactionsReplies: 5Last Post: 28th Sep 2011, 11:05 AM -
vbulletin 4 php include
By Klinzter in forum Webmaster DiscussionReplies: 0Last Post: 31st Aug 2011, 09:13 PM -
[PHP]Include functions scope
By Robin H in forum Web Development AreaReplies: 6Last Post: 10th Jan 2011, 06:01 PM -
[TUT]Achieving a PHP Include in a template bit
By Lease in forum IP.BoardReplies: 0Last Post: 13th Jan 2008, 01:32 AM
themaPoster - post to forums and...
Version 5.11 released. Open older version (or...