I need to insert a google adsense square box in the middle of all articles on the site.
What is the best approach?
The site is in drupal, so I figures I can hook to the view node function. this way the ad won't be saved together with the article. does that make sense? If so, than the question is how do I ensure I won't have image on the other side of the ad (the ad is aligned to the left and should take 50% of the article width)?
should I be using a block? but how will I know to place the block in inside the block.
So in short, I really have no idea where to start to implement it... How is this thing implemented in all the news sites?
I'd approach it by implementing a custom input filter that would insert the AdSense code (or the AdSense module shortcode, if you want) into the processed text. Once you have that custom filter implemented, you'll have to enable it in the text format you're using for the content type.
For implementing a custom filter, take a look at filter_example here.
This solution is for Drupal 7. The solution which worked for me is that I used the adsense tags format and then used this format to show ads on the site. Note that this line doesnot need any js inclusion or script tags. You just need to enable the Adsense tags format(I mean shortcode). Actually I was getting Ads disabled for admin and for other users i was getting the empty ad with space occupied on page but nothing shown. After different tweaks and experiments I got the following code working for me
[adsense:336x280:XXXXXXXXXX]
2nd parameter is width x height
3rd parameter: XXXXXXXXXX denotes the google ad slot/id.
I hope this will help others.
Ata ul Mustafa
I need to insert a google adsense square box in the middle of all articles on the site. What is the best approach?
From my experience:
On some drupal sites I used simply node editor to put box with adsense into content. For websites with not many nodes its best solution because of:
1) Box perfect fits in rest of content - you can change it manually.
2) Total control of viewed boxes - images, flash, text adds etc.
Etc.
But for websites with many nodes, this solution looks like stupid suicide.
Better option will be change node.tpl file in your theme folder. But there is some trouble. In this file, you have $content variable, with contains all of content in this node. This situation gives you ability to put box up or down of this node. But no in the middle. Perhaps solution will be to divide $content into 2x variables which will contains a half of contents. But question is - how do to it? Or maybe while content from node is saved into database, then you can put some html code with adsense box? And search best position to put box by regular expressions? Or maybe change all of nodes by adding html box directly in database?
should I be using a block? but how will I know to place the block in
inside the block.
As I remember, you cannot put block inside another block.
Related
I have a couple of questions related to building a custom theme with Wordpress.
1) If the website is made up of pages, I can use page .php to run the LOOP and retrieve content. In this case, is it OK to paste the content (of each page) using the backend of word press - I.e. paste all content and HTML markup into the 'text; . Is this a reliable way to enter content and accompanying markup into the database?
I guess the advantage is that users will then be able to edit the content themselves using the visual Tab.
Many thanks,
P
Well this not a recommended way to do it, but yes the editor is there for the same purpose. I wont be using it this way, because in my experience wordpress editor often acts weird with html. By default auto paragraphs are enabled, so everything gets in its own paragraph, even if you disable auto paragraph it still has some issues. For instance if you add html in the text tab, and then goto visual tab and switch back to html, and save the same html, this time it would be styled differently. Secondly its also not good to allow users to add html from a security POV and you cant guarentee the consitency of the website.
I would recommend using custom fields instead and fetch these custom fields in the through your theme files.
I am wondering if there is anyone out there who knows about Views in Drupal 6, specifically the Ticker aspect that could assist me with the following issue:
I have to create a news ticker that reads in the titles from a specific content type and then prints out those titles in a horizontally scrolling fashion. That is the easy part, I have gotten that to work. The part that I am having issues with is I then need to format this ticker to be a specific font, placed in a specific location on the webpage, but still take in the feed from the content types that it is supposed to. Does anyone know how to use this/ has anyone done anything that works similarly to this in the past?
I would also like to apologize if this is a dumb question, but I do really need assistance.
Thank you
I'd suggest enabling a views block which will allow you to move the view into any region. Defining a custom region will allow you to add the view anywhere within your site. You can also use views_embed_views() which allows you to reference the view directly. Your view will likely require additional JS to load for the ticker function to work and a modified version of using views_embed_view() with slideshow should help.
So I built up this Wordpress theme for my buddy. The design was already set, so I just built what I think/thought is a pretty robust template.
We've had a few issues a long the way, and the final stumbling block is the ad block on the top of the sidebar on the right hand side.
If you refresh until it displays a video, it breaks everything - not only the stuff that's below the sidebar call, but the body too.
Can anyone please give me some insight? I'm going insane. I've been working on this project for too long and just want to fix this final problem.
http://www.touchlinetalk.com/
Uh, help!?
Your code is not valid (check with http://validator.w3.org/). A lot of elements are not closed, overlapping, some anchors are not closed, etc. Adding your video probably introduces a new div element or something like this, which actually interfers with the overlapping other elements you have in your page and breaks the layout. You should give a link to the page that does not work (call it "proof of concept") and not to a page that is OK.
If you are using WordPress, here is a really handy function for you, to avoid non-closed tags: force_balance_tags(). It closes tags that havent been closed. More info here: http://codex.wordpress.org/Function_Reference/force_balance_tags
I need to get this meny done, but the programmers say it's not possible to do what I want.
I find it hard to believe, so I'm asking you guys if this is possible.
Check out this page: http://www.nsquareit.com/lottemcgill/
Click the "Archive" in the menu below the logo. Here you can slide the three pins to make a selection to search for. The text that displays the selected value for each slider is now following the pin itself. I want that text to be static on the right side of the pins.
Is this possible?
He says the dealbreaker here is that the logo and menu itself should have fixed position. The logo and menu should not scroll with the page itself, but rather say where it is at all times. (like it is now).
So, is this possible? I believe it is. I cant see why not..?
Thanks =)
Try http://jqueryui.com/demos/slider/, it's easy to use, customizable and you can place it anywhere you want (including fixed elements)
I want to make a sort of repeating slideshow banner for my website, but i need some help on how to do it. The best example of what i want is on the play.com website, they have a banner that has 5 different slides, the site scrolls between them after X amount of time but the user can also click on one of the numbered buttons at the bottom of the banner to skip.
I'm thinking of doing this using HTML, CSS, JavaScript, AJAX and PHP. I have an Ajax script set up already linking to a php page that will at somepoint check through a database to get its content. But i want to output everything using lists lu and li.
So does anyone know of any tutorials or something i could use to get something like on play.com? play.com is more or less and exact match to what i want.
Thanks for the help.
You can use jQuery in combination with slideshow plugins. You don't have to do much by yourself. A plugin which does what you want can be found here:
http://slidesjs.com
You can also search Google for "jquery slideshow". This should return lots of pages with plugins.
I use http://jquery.malsup.com/cycle/ as it has a very basic fade but also lots of different animations if needed.
Unless you have a good reason for it, there's no need for you to create the slider yourself, there are tons of options already made (and tested).
I often use this two:
http://nivo.dev7studios.com/demos/
http://jquerytools.org/demos/scrollable/index.html
here is a really simple one that loops through any number of <img> elements placed inside a <div class="slideshow"> wrapper and it only uses a few lines of jQuery and css...
http://jsfiddle.net/DaveAlger/eNxuJ/1/
hope this helps someone else