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

can I use smoke.js to have an notification without a click #34

Open
petrospap opened this issue Apr 4, 2013 · 2 comments
Open

can I use smoke.js to have an notification without a click #34

petrospap opened this issue Apr 4, 2013 · 2 comments

Comments

@petrospap
Copy link

Dear all
I would like to use smoke.js for my site, unfortunately I do not have much knowledge of javascript, neither on php but OK I trying to learn.
What I have and I need to change is when I submit for something (e.g for contact) if is successful or not returns an output a simple link like this

$title = $error == 0 ? l(completed_ok') : ($error !== 0? l('error') : l('warning'));
$note = (!$note || empty($note)) ? '' : '<p>'.$note.'</p>';
$goto = '<p><a href="'._URL.'">'.l('home').'</a></p>';
$output = '<h3>'.$title.'</h3>'.$note.$goto;

My question is can I use smoke.js to have an notification without a click
and If I am not asking too much, is it possible to give me any example!
Thank in advance.

@jyoungblood
Copy link
Owner

yeah, you totally can (i do it all the time in the custom admins i make). it's kinda hard to tell where it would fit in with this code, but you can execute it without a click by just calling smoke.signal() in a normal javascript context. i could try to help further if i had more of an idea of what all is happening with your script.

@petrospap
Copy link
Author

Hi jyoungblood thanks for your reply you help me a lot
simply like this I get all the information I need and I got smoke :)

?>
<script type="text/javascript">
smoke.signal('<?php echo $output; ?>');
</script>
<?php

But I got one small issue, is there any trick to make it work by adding the smoke.js in the bottom of html instead of top?

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

2 participants