Advanced search  

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

Pages: [1]   Go Down

Author Topic: how to insert ad code in the header?  (Read 10052 times)

0 Members and 1 Guest are viewing this topic.

khuram

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
how to insert ad code in the header?
« on: May 30, 2014, 08:45:41 pm »

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
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

khuram

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: how to insert ad code in the header?
« Reply #2 on: May 31, 2014, 08:03:56 am »

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
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: how to insert ad code in the header?
« Reply #3 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.

Read this thread: http://forum.coppermine-gallery.net/index.php/topic,77566.msg374917.html#msg374917
« Last Edit: May 31, 2014, 07:56:26 pm by allvip »
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: how to insert ad code in the header?
« Reply #4 on: June 01, 2014, 03:12:56 am »

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...)
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

khuram

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: how to insert ad code in the header?
« Reply #5 on: June 01, 2014, 04:27:07 am »

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?
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: how to insert ad code in the header?
« Reply #6 on: June 01, 2014, 07:57:02 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.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

khuram

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: how to insert ad code in the header?
« Reply #7 on: June 01, 2014, 08:47:42 am »

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?
Logged

khuram

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: how to insert ad code in the header?
« Reply #8 on: June 01, 2014, 11:16:15 am »

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?
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: how to insert ad code in the header?
« Reply #9 on: June 01, 2014, 01:56:21 pm »

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.)
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

khuram

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: how to insert ad code in the header?
« Reply #10 on: June 02, 2014, 04:10:07 pm »

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?
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: how to insert ad code in the header?
« Reply #11 on: June 02, 2014, 05:23:22 pm »

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

Find the tag:
Code: [Select]
    {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:
Code: [Select]
    {CUSTOM_HEADER}Find:
Code: [Select]
    </div>
    <div id="cpg_main_block_outer">
Replace with:
Code: [Select]
    </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.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 21 queries.