I have a site where we want to show ads in a block. The content of the ads, however, is unique to each node. I am happy to put the content into a CCK field of the node, but I don't see a direct way to know the node being displayed.
I can determine it programatically using arg(0) etc, and this seems like it will work, but I am wondering if there is an easier way. :)
Some of the pages will also be Views, not just node pages.
Thanks.
Fred,
I didn't quite get if your idea includes putting tthe ad content in a cck field, thus getting yourself out of the need to create a new block for each node.
Shai
On 11/26/07, Fred Jones fredthejonester@gmail.com wrote:
I have a site where we want to show ads in a block. The content of the ads, however, is unique to each node. I am happy to put the content into a CCK field of the node, but I don't see a direct way to know the node being displayed.
I can determine it programatically using arg(0) etc, and this seems like it will work, but I am wondering if there is an easier way. :)
Some of the pages will also be Views, not just node pages.
Thanks.
[ Drupal support list | http://lists.drupal.org/ ]
I didn't quite get if your idea includes putting tthe ad content in a cck field, thus getting yourself out of the need to create a new block for each node.
Yes, the content of the ad can go into the CCK field, BUT we need that content to show up on the web page in the 'right sidebar' part of the page. The standard way to put content there AFAIK is via a block. But in my case the content is actually part of the node. Thus my first inclination is to use PHP to get the content from the node.
Same concept applies to Views--not sure really even where to store the content for ads specific to views. Each view is determined, furthermore, but an argument, so myview/2 will need different ad content than myview/3. I could store those in a new CCK type called 'viewads' perhaps...
any ideas are appreciated. :)
Thanks!
Fred,
I think you put the PHP in the area on Views called "Argument Handling Code". It's one of those ajaxy sections of the Views page that is closed by default. I haven't used it myself but I think that is where you put your code and what you are doing should be pretty easy to do with a block enabled View.
shai
On 11/26/07, Fred Jones fredthejonester@gmail.com wrote:
I didn't quite get if your idea includes putting tthe ad content in a cck field, thus getting yourself out of the need to create a new block for each node.
Yes, the content of the ad can go into the CCK field, BUT we need that content to show up on the web page in the 'right sidebar' part of the page. The standard way to put content there AFAIK is via a block. But in my case the content is actually part of the node. Thus my first inclination is to use PHP to get the content from the node.
Same concept applies to Views--not sure really even where to store the content for ads specific to views. Each view is determined, furthermore, but an argument, so myview/2 will need different ad content than myview/3. I could store those in a new CCK type called 'viewads' perhaps...
any ideas are appreciated. :)
Thanks!
[ Drupal support list | http://lists.drupal.org/ ]
The ads are always part of the node content? If so, maybe it's just a theming task, to display that node piece in a box on the right side.
Otherwise, using arg() in your block's PHP code to learn the node is acceptable.
Chris Johnson wrote:
The ads are always part of the node content? If so, maybe it's just a theming task, to display that node piece in a box on the right side.
Well, I thought of this, but also there are ads associated with views, and each view will have a different ad. Since the actual view content is determined by an argument would be difficult if not impossible.
Otherwise, using arg() in your block's PHP code to learn the node is acceptable.
Great. This method would also work for views.
Thanks! :)