Popup window

General questions about CMSimple
oldnema
Posts: 265
Joined: Wed Jan 21, 2009 5:15 pm
Location: Czech Republic
Contact:

Popup window

Post by oldnema » Fri Jun 22, 2012 11:58 am

Hello developers,
Sometimes I need to publish the entry page very, very important short message.
I would be very liked a similar solution as shown here http://famnissen.dk/cmsimple_addon/?Welcome
It is feasible and does anyone have any idea?
Thank you, Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Popup window

Post by cmb » Fri Jun 22, 2012 12:55 pm

Hi Josef,

you can do it with hi_Fancybox. activate has to be 1. Make a new hidden CMSimple page called "Important" that contains the message. Then insert on your start page in source code mode:

Code: Select all

<a id="important" href="?Important&print">Important Message</a></p>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').fancybox().click()})
// ]]></script>
This should open the Fancybox automatically in view mode. The link is not strictly necessary, but it's probably a good idea to have it, so a visitor having JS disabled can view the message nonetheless.

Note that the <script> can not be seen in the WYSIWYG mode, so be careful to not delete it accidentially.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

oldnema
Posts: 265
Joined: Wed Jan 21, 2009 5:15 pm
Location: Czech Republic
Contact:

Re: Popup window

Post by oldnema » Fri Jun 22, 2012 2:18 pm

cmb wrote:Hi Josef,

you can do it with hi_Fancybox. activate has to be 1. Make a new hidden CMSimple page called "Important" that contains the message. Then insert on your start page in source code mode:

Code: Select all

<a id="important" href="?Important&print">Important Message</a></p>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').fancybox().click()})
// ]]></script>
This should open the Fancybox automatically in view mode. The link is not strictly necessary, but it's probably a good idea to have it, so a visitor having JS disabled can view the message nonetheless.
Note that the <script> can not be seen in the WYSIWYG mode, so be careful to not delete it accidentially.
Christoph
YEP! That's what I needed, works perfectly!
Christoph, really, very, very much - Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates

mitch
Posts: 45
Joined: Mon Oct 03, 2011 1:56 pm

Re: Popup window

Post by mitch » Thu Oct 04, 2012 11:38 am

Is it possible to define a class? To the link OK, it's working(see below), but I also need the class "zoom" for the pop up that opens automatically. Otherwise it opens with the default HI-fancy options and not with those that have been configured in the plugin config...

Code: Select all

<p><a class="zoom" href="?simeda:PopUp&print" id="important">Important Message</a></p>
<p>&nbsp;</p>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').fancybox().click()})
// ]]></script>

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Popup window

Post by cmb » Thu Oct 04, 2012 12:08 pm

Hi mitch,

basically that's possible. The main problem is, that the "message" fancybox is triggered from the content, but the settings of hi_fancybox are applied later (see the generated HTML source code). An additional problem is the explicit fancybox().click(), which will cause the fancybox for the message to use the fancybox defaults.

The solution: put the <script>...</script> to the template, just after the <?php echo content();?> and change it slightly:

Code: Select all

<?php echo content();?>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').click()})
// ]]></script>
On the page, you have to write only:

Code: Select all

<a class="zoom" href="?simeda:PopUp&print" id="important">Important Message</a> 
Christoph
Christoph M. Becker – Plugins for CMSimple_XH

oldnema
Posts: 265
Joined: Wed Jan 21, 2009 5:15 pm
Location: Czech Republic
Contact:

Re: Popup window

Post by oldnema » Thu Oct 04, 2012 1:12 pm

Just a thought: it could be used plugin "Privacy XH" ;)
It would be an advantage in that the window popped once.
Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates

mitch
Posts: 45
Joined: Mon Oct 03, 2011 1:56 pm

Re: Popup window

Post by mitch » Thu Oct 04, 2012 2:46 pm

cmb wrote:Hi mitch,

basically that's possible. The main problem is, that the "message" fancybox is triggered from the content, but the settings of hi_fancybox are applied later (see the generated HTML source code). An additional problem is the explicit fancybox().click(), which will cause the fancybox for the message to use the fancybox defaults.

The solution: put the <script>...</script> to the template, just after the <?php echo content();?> and change it slightly:

Code: Select all

<?php echo content();?>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').click()})
// ]]></script>
On the page, you have to write only:

Code: Select all

<a class="zoom" href="?simeda:PopUp&print" id="important">Important Message</a> 
Christoph
Thanks that works!!

mitch
Posts: 45
Joined: Mon Oct 03, 2011 1:56 pm

Re: Popup window

Post by mitch » Tue Nov 06, 2012 2:40 pm

oldnema wrote:Just a thought: it could be used plugin "Privacy XH" ;)
It would be an advantage in that the window popped once.
Josef
How would that work. Thats exactly what I'm searching for now. The pop-up shoud open only once....

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Popup window

Post by cmb » Tue Nov 06, 2012 3:18 pm

Hi mitch,

Privacy_XH is primarily meant to comply to the EU cookie law (and other similar laws). But indeed it might be used for this purpose too (thanks to oldnema's creativity!). It shows the message on every page, but when the user confirms that he read it, the plugin sets a cookie in the visitor's browser. If this cookie is already set, the message won't be shown again.

You have to consider, that switching off the messages requires cookies to be enabled in the visitor's browser, and that a new message will not be shown, if the cookie is still set in the browser (you can configure the durability of the cookie in the back-end).

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

mitch
Posts: 45
Joined: Mon Oct 03, 2011 1:56 pm

Re: Popup window

Post by mitch » Wed Nov 07, 2012 9:58 am

cmb wrote:Hi mitch,

Privacy_XH is primarily meant to comply to the EU cookie law (and other similar laws). But indeed it might be used for this purpose too (thanks to oldnema's creativity!). It shows the message on every page, but when the user confirms that he read it, the plugin sets a cookie in the visitor's browser. If this cookie is already set, the message won't be shown again.

You have to consider, that switching off the messages requires cookies to be enabled in the visitor's browser, and that a new message will not be shown, if the cookie is still set in the browser (you can configure the durability of the cookie in the back-end).

Christoph
And how to use it concretely combined with the fancy box script from above.?

Post Reply