Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shift away from the phtml template #9

Open
captn3m0 opened this issue Mar 21, 2017 · 0 comments
Open

Shift away from the phtml template #9

captn3m0 opened this issue Mar 21, 2017 · 0 comments

Comments

@captn3m0
Copy link
Contributor

The phtml template method breaks separation of concerns and is not clean (using str_replace for templating is bad because PHP is a templating language by itself)

Alternative Solution:

  1. Embed a javsacript snipped via a .js file in the codebase that is injected on our page using wp_enqueue_script
  2. The only parameter needed when we call the script is pageId, so we embed a tiny snippet in the template that does it safely.
<button id="rzp-quick-btn" data-pageID="<?echo $pageId;?>"></button>

The event handler is attached via the script injected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant