When typing on a blog post, I would like to insert code for Adsense or another code using a short-name that references the code rather than pasting the code directly into my blog post. Is there an easy way to do this?
For example, I would like to define a short-name like this:
"dogphoto" = "<img src="http://www.news.cornell.edu/stories/Sept05/dog.jpg" />"
Then I could merely reference the short-name for the code by typing this:
"I love dogs. I love all dogs. Here is a photo of a Dog. {dogphoto}. Isn't that dog cute?"
The resulting HTML would be this:
"I love dogs. I love all dogs. Here is a photo of a Dog. <img src="http://www.news.cornell.edu/stories/Sept05/dog.jpg" />. Isn't that dog cute?"
I presume this could be done by including a text file. A Wordpress plugin (MiniManager) does this by allowing users to "name" a mini-block of code and then call that code in the blog post by referencing it.
Is there a way to do this in Drupal? If so, it would be a time-saver for repetitive blocks of code that need to be entered when writing a blog post or page. It could be used to insert Adsense ads, Yahoo Ads, a disclaimer at the end of the post, etc.
Thanks in advance for any suggestions.
Comments
Quasi work-around
Here is a complex way to partly accomplish this task. These instructions place Adsense code (or any code) after the first paragraph of a blog post. See http://www.alldrupalthemes.com/blog/automagically-placing-adsense-inside....
Unfortunately, these instructions don't give the writer control over where the code is inserted. Also, these instructions require modifying Drupal files, which is scary for a newbie.
Any other ideas?
Would this work?
I found this suggestion online. Would this work?
The problem with this is it only displays a sidebar block that is already rendered on the page.
Another option would be putting the Adsense code into a block, and then calling the block from within the blog post as described here: http://drupal.org/node/26502. Would this work?
Not working - help still needed
None of these options seem to work. Does anyone have any other ideas?
If I can't get this
If I can't get this resolved, I'll have to give up on Drupal.
Possible solution
A Drupal expert at http://www.drupal4seo.com/ tells me that the solution referenced above (inserting the block into the content) will work. But she said that in order for it to work, you do have to activate it under 'input format' and then select that option on the content page.
Another guide
Here is another relevant tip: "Insert Block into Content" at http://drupal.org/node/161443.