I'm trying to add some custom code after creating a new content. I have rules module with event "After saving new content" and action "Execute custom PHP code", but how do I echo or return some code?

Let's say I want to pass some image with width:1px just to be displayed in the page source, not visible on the page.

I've tried with echo '<img....'; but it didnt print in the source.

Is any specific way to add PHP code with custom PHP filter?

Comments

drupalfan4ever’s picture

Issue summary: View changes
drupalfan4ever’s picture

Issue summary: View changes
drupalfan4ever’s picture

Issue summary: View changes
drupalfan4ever’s picture

OK, my point is after successful "create a new content" to send a custom HTML code, to be visible on the source page. Maybe PHP filter is not preferred way, but please anyone share some idea how to achieve this.

tr’s picture

Status: Active » Closed (works as designed)

my point is after successful "create a new content" to send a custom HTML code, to be visible on the source page

There are many ways to customize the HTML output of Drupal. Rules is really the wrong way to go about this - Rules is for workflow, not for theming of output. You can do this indirectly by, for example, using Rules to set a flag on the content. Then you can use normal theming to customize the output based on that flag. But Rules is not the right place to be emitting HTML.