Support Forum
Yellow Swordfish said
It IS spTopicView.php. You will find the bit Steve suggested in there.
Yes you are right, my apologies.
When I opened it previously it was in notepad. When I opened it in Dreamweaver I found it..mostly.
In my spTopicView.php I found the following:
"sp_InsertBreak();
sp_SectionEnd('', 'post');"
and I inserted my echo after this - it worked to some extent. It shows below the first 3 or 4 posts. Not after the first post only.
I could not find this code:
"$spTopicView->current_post==1"
So I'm almost there.
Did you want me to include this bit of code myself?
Thank you Yellow Swordfish - I'm sorry about using Notepad to find the code before, I have learnt from this.
You're so fast mate! Thank you!
I'm afraid I could not get it to work.
This is what I have - where am I going wrong?:
sp_InsertBreak();
sp_ColumnEnd();
sp_InsertBreak();
sp_SectionEnd('', 'post');
if ( $spTopicView->current_post == 1 ) {
echo show_ad_camp_3();
}
endwhile; else:
sp_NoPostsInTopicMessage('tagClass=spMessage', __sp('There are no posts in this topic'));
endif;
Brandon C said
Here is how you can do it.First create your own theme so any changes you make are not over written by updates. See here on how.
http://codex.simple-press.com/.....g-a-theme/
Since you want to use the adsense code in multiple paces I would create a function for it.
It appears you have seen the files in yourthemes/template folder. One of the is spFunctions.php. This is a file that you can add a function to, among other things, that your theme can use.
Create a function for your ad. Let's call it spAddCode
Open the spFuntions.php file up in your editor and at the bottom just above the closing ?> is where you can add the function.
Your function should look something like this.
function spAddCode() {class="brush-php syntax">spAddCode();
I am trying to add ads and this is what my function looks like
function show_ad() { sp_adsense ('<script type="text/javascript"><!-- google_ad_client = "ca-pub-8654929854924223"; /* Top & Bottom */ google_ad_slot = "2182142041"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>'); }
After doing that I put this code into sp_topic_view.php:
if ( $spTopicView->current_post == 1 ) { echo show_ad(); }
But my add is not showing anywhere. What am I doing wrong.
not sure what you are trying to do... if you are going to 'echo' the ad content, the function needs to return something... and not sure what sp_adsense() is... so something like
function show_ad() { return '<script type="text/javascript"><!-- google_ad_client = "ca-pub-8654929854924223"; /* Top & Bottom */ google_ad_slot = "2182142041"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>'; }
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)