how to insert ad code in the header? how to insert ad code in the header?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

how to insert ad code in the header?

Started by khuram, May 30, 2014, 08:45:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

khuram

i just installed the gallery
www.braindirector.com/gallery
i have somehow inserted the add code in the footer probably bacause it was easy. now i want to insert a banner code of the same size in the header. can any one kindly guide me how to do so? step by step i mean

Jeff Bailey

Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

khuram

Thanks Jeff but it really did not make much sense to me. i'd appreciate if you could get this done for me. i can send you log in details and ad code via pm

allvip

#3
I hope is ok if I answer to say how I display ads on my coppermine gallery.

Read this thread: http://forum.coppermine-gallery.net/index.php/topic,77566.msg374917.html#msg374917

gmc

Quote from: allvip on May 31, 2014, 07:23:03 PM
I hope is ok if I answer to say how I display ads on my coppermine gallery.

Input always welcome... And certainly your method works - but a bit more complicated for someone not familiar with CPG's themes, or not comfortable editing files.

The solution Jeff linked to is quite simple...
Create 2 files - customheader.php and customfooter.php for example
Put the ad code for top and bottom in their respective files. Upload to your host.
In Config, put the path to the two files (if loaded to Coppermines folder, just the filename) - and you are done...
Across all themes the code will be inserted just after <body> (header) and just before </body> (footer)

(always nice to have an 'unmodified' theme around in case something goes wrong...)
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

khuram

here is what i understood
i have to create 2 files named customerhearer.php and custom footer.php
and then i have to upload these too files to coppermine root folder.
two questions here.
will these two files contain the ad code only and nothing else?
if ad code only, will it start getting displayed right after i upload these two files? or will i have to edit anyother file as well to make ads show up?

gmc

Quote from: khuram on June 01, 2014, 04:27:07 AM
will these two files contain the ad code only and nothing else?
The ad code alone should be fine. Certainly can add anything you want.
Quote
if ad code only, will it start getting displayed right after i upload these two files? or will i have to edit anyother file as well to make ads show up?
You need to tell Cooperative the filenames - as they change named anything and located anywhere in your site.
in 'config', expand Theme Settings, and put the filenames into fields "Path to custom header include" and "Path to custom footer include" and save.
You should see the ads appear.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

khuram

Okie i followed the steps above. created two files with ad code uploaded to the gallery root folder then added path www.braindirector.com/gallery/customheader.php
but it did not work
then i changed the path to /customheader.php
and it did not work either.
what to do now?

khuram

So, i made it work and now i can see ads but the problem is that the ad in the header is not appearing in the center?
another question is, does having ads displayed on your webpage have any negative impact on website's search engine appearence?

gmc

I assume you eliminated the / to make it work...

To center, normal html rules/processes.
Quick way: add <center> before the ad code, and </center> after in each file...
Right way: find a CSS class in your theme with the correct attributes and use that in the appropriate tag.
                (hint - look and the code around the footer you first changed. It is centered.)
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

khuram

i want to ad the ad code so that it appears right under the home, gallery, upload menu. tell me where exactly am i to ad the ad code to make it appear under the menu?

gmc

Now it becomes theme specific...
Open your themes 'template.html' file in an editor - located at yourcpgfolder/themes/yourthemename/template.html

Find the tag:
    {CUSTOM_HEADER}
This tag can be moved to wherever you like in the template.

For your requested placement - I would suggest:
Find and delete line:
    {CUSTOM_HEADER}
Find:

    </div>
    <div id="cpg_main_block_outer">

Replace with:

    </div>
    {CUSTOM_HEADER}
    <div id="cpg_main_block_outer">


I would suggest you create your own theme folder if customizing a CPG core theme (a theme distributed in the releases) - to avoid future upgrades overlaying your changes.  Just create a new folder in themes/ and copy the theme you are modifying... Change your config to use the new theme.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money