Newbie trick

Status
Not open for further replies.

glowleaf

My head annoys people
Jun 27, 2007
1,118
23
0
www.glowleaf.net
This is a trick that will save you a lot of time if you are creating content.
Dont flame, its intended for newbies. Maybe not total newbies, but... Oh well, just ignore it if you know it already.

(vBulletin nagged me because I havent posted in a long time, so I thought I should share something)

When you get banned from a network, or when you simply want to try something new, you need to change and upload all the new htmls with affiliate code on them. If you are like me, with massive sites, that takes forever. (I'm close to 70 Mb per site, and 80Gb in total)

Try to make a habit of creating things modular, that means "pluggable" and "unpluggable".

Ill explain. In your content creation script, instead of slapping the adsense/affiliate code right in the html, try this:

make a config.php with definitions, something like this (italics means you put your own settings in):

<?php
define('SITE_META_DESCRIPTION', 'Books');
define('SITE_META_KEYWORDS', 'book');
define('ADSENSECHANNEL', '213425');
define('PUB_ID', 'pid-123456778');
?>


Make your creator include the config.php file in every html (add at the very top of the code):

<?php include('config.php'); ?>

and finally make an adsense.php (adsensebanner.php-adsenseblock.php-adsensewhateva.php):

<?php
if (strlen(PUB_ID) > 0) {
if (substr($_SERVER['QUERY_STRING'], -4) == "maxi") {
?>
<script type="text/javascript"><!--
google_ad_client = "<?php echo PUB_ID; ?>";
google_alternate_color = "ffffff";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al";
google_ad_channel ="<?php echo ADSENSECHANNEL; ?>";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "000080";
google_color_url = "575757";
google_color_text = "575757";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<?php
}
}
?>


OR you can paste your affiliate code.

This allows you to simply paste:

<?php include('adsense.php'); ?>

into your html, and every time the page is loaded, it will include the adsense code, or the affiliate code.

This helps to easily change pids, affiliate offers, or anything else.

To change meta tags you need something like this in your html files:

<html>
<head>
<title></title>
<meta name="keywords" content="<?php echo SITE_META_KEYWORDS; ?>">
<meta name="description" content="<?php echo SITE_META_DESCRIPTION; ?>">

<link rel="stylesheet" type="text/css" href="etc/stylesheet.css">
</head>
<body>


You can expand this to everything, links, rss, images etc.

In summary, make all your generated htmls load from a single file the data you want, so you only need to change one file every time, instead uploading 50 Mb all over again.

Another trick is to use amazon. The astores and the widgets they provide are modular, meaning they load from amazon (configured by your settings there), instead from your site. If you change a setting there, it will change instantly in all your sites. I am fond of the search widget (not the search box). It fits perfectly below the navigation.

Long post, but I hope it helps.
 


Fuck ALL that shit. Overcomplicate much?

Look, put your adsense code in a plain htm file (no head tags) and use server side includes. Only requires .shtml or .php pages. Done.

It's also smart to server side include your copyright footers on your sites so that you can update the year in a few seconds.
 
Actually, this is a great post for those who are trying to build/manage a large number of big content sites. These are the kind of things that save me tons of time building templates for my database sites, a la SEO Empire.
 
ScottDaMan said:
It's also smart to server side include your copyright footers on your sites so that you can update the year in a few seconds.
Copyright © <?php echo date('Y'); ?>
I just put you lightyears ahead of your competitors, no more outta date copyrights!
 
Nice addition illusion.

Look, this is one of the things I wish someone had told me before I generated my first Gb of content. As I said: take it or ignore it.
 
If you want to change things you can always do a global search and replace for html code in like Dreamweaver. You could even do a search and replace to illusions code if you never want to do that yearly.
 
If you want to change things you can always do a global search and replace for html code in like Dreamweaver. You could even do a search and replace to illusions code if you never want to do that yearly.

Dreamweaver can only handle a finite amount of files. The fastest tool I have found to do that easily is called "Replace In Files" (look it up). But, still, you have to reupload everything. Also, I'm talking about massive sites.
 
Dreamweaver can only handle a finite amount of files. The fastest tool I have found to do that easily is called "Replace In Files" (look it up). But, still, you have to reupload everything. Also, I'm talking about massive sites.


You can also do this from the command line.

perl -i -pe 's/replacethis/withthis/g' *.php
 
Yes, using includes for ad data is a very old and still very useful thing. And that is a wonderful explanation for newbies really.

If you want to change things you can always do a global search and replace for html code in like Dreamweaver. You could even do a search and replace to illusions code if you never want to do that yearly.

Why go through all the trouble, that means download 70 MB of pages, finding and replacing data for them across all pages and then re-uploading them.

You can also do this from the command line.

perl -i -pe 's/replacethis/withthis/g' *.php

Don't you think what's mentioned is a better idea ?
 
Yes, using includes for ad data is a very old and still very useful thing. And that is a wonderful explanation for newbies really.



Why go through all the trouble, that means download 70 MB of pages, finding and replacing data for them across all pages and then re-uploading them.



Don't you think what's mentioned is a better idea ?

For the original posts yes but I am never going to use dream weaver and especially not for search and replace when I can use a perl one liner in a couple seconds.
 
I use this too for my sites. On some cpanel accounts I even use the same file for different domains (include ../config.php)
 
Status
Not open for further replies.