link vs. optional newsbox
link vs. optional newsbox
There is a way to link a subpage with a specific newsbox using newsbox($variable). I would like, however, to link only a text in a subpage to show specific newsbox. Is it possible? There is a way how to make is with simple HTML and java, evtl. with an iframe. But how about under CMSimple_XH?
Something like this:
[ external image ] [ external image ]
Something like this:
[ external image ] [ external image ]
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: link vs. optional newsbox
Do you mean you want this particular newsbox to be shown, when the text is clicked? This could be accomplished by adding a parameter to the link URL, e.g. <a href="./?NAME_OF_THE_SHOWN_PAGE&newsbox=NAME_OF_THE_NEWSBOX">. Then you can do in the template:
Note, that anybody could request an arbitrary newsbox when you do this (however, that shouldn't be a problem).
Code: Select all
<?php echo newsbox(isset($_GET['newsbox']) ? $_GET['newsbox'] : 'DEFAULT_NEWSBOX_NAME');?>
Christoph M. Becker – Plugins for CMSimple_XH
Re: link vs. optional newsbox
WEll, seems logical.
I dropped the code on the page, but it shows after saving
In the template
The result is, that on opening the website no newsbox is shown (the area for the newsbox is empty).
There are two subpages prepared:
Welcome - to be show generally in newsbox
Sidebox - to be called on by the link, replacing the Welcome Page.
Using the link the page is only shown in the content area.
I dropped the code on the page, but it shows after saving
Code: Select all
<p><p><a href="./?Sidebox&newsbox=NEWSBOX"><strong>CLICK HERE</strong> (Slovakia)</a></p></p>
Code: Select all
<?php if($adm=='true') {
echo toc();
}else{
echo newsbox(isset($_GET['newsbox']) ? $_GET['newsbox'] : 'NEWSBOX');
}
?>
There are two subpages prepared:
Welcome - to be show generally in newsbox
Sidebox - to be called on by the link, replacing the Welcome Page.
Using the link the page is only shown in the content area.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: link vs. optional newsbox
Please try the following (replace THIS_PAGE with the name of the page the link is on):
and
Code: Select all
<p><a href="./?THIS_PAGE&newsbox=Slidebox"><strong>CLICK HERE</strong> (Slovakia)</a></p>
Code: Select all
<?php if($adm=='true') {
echo toc();
}else{
echo newsbox(isset($_GET['newsbox']) ? $_GET['newsbox'] : 'Welcome');
}
?>
Christoph M. Becker – Plugins for CMSimple_XH
Re: link vs. optional newsbox
Thanks a lot. It works. I just will try to change it to onMouseOver. It seems easier to me, than add some close button into the newsbox.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: link vs. optional newsbox
Fine.Tata wrote:Thanks a lot. It works
Hm, in this case you'll probably want to load the content of the newsbox by Ajax. I thought about this in the first place, but it is more difficult to accomplish and it requires JavaScript (even nowadays I prefer to make a general accessible website working without JavaScript, and only add enhancements that require it).Tata wrote:I just will try to change it to onMouseOver. It seems easier to me, than add some close button into the newsbox.
A basic outline:
- deliver the page without any newsbox content, but with an empty element instead
- on mouse over, load the newspage as content view, and replace the content of the empty element with it
- on mouse out, discard the replaced content
- Add an empty newsbox with id="dynamic_newsbox" to the template:
Code: Select all
<div id="dynamic_newsbox"></div>
- "Install" the "content" addon
- we'll use jQuery, so set it's autoload option to on
- place the following JS in a file newsbox.js in the CMSimple_XH installation folder:
Code: Select all
jQuery(function ($) { $("a.dynamic_newsbox").mouseenter(function () { $.get($(this).prop("href"), "", function (data) { $("#dynamic_newsbox").html(data); }); }).mouseleave(function () { $("#dynamic_newsbox").html(""); }) });
- load this JS file in the template:
Code: Select all
<script type="text/javascript" src="<?php $pth['folder']['base'];?>newsbox.js"></script>
Code: Select all
<a href="./?Sidebox&content" class="dynamic_newsbox">TEXT</a>
Christoph M. Becker – Plugins for CMSimple_XH
Re: link vs. optional newsbox
Yes, I have found the AJAX solution also. So far I've solved it by a "close" button in the opened newsbox, it works.
I'll try this tomorow.
Thank you again.
I'll try this tomorow.
Thank you again.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: link vs. optional newsbox
In this case I would need to place som image as a background of the empty newsbox. E.g. the content of the page that's loaded now on the beginning.cmb wrote:A basic outline:
- deliver the page without any newsbox content, but with an empty element instead
- on mouse over, load the newspage as content view, and replace the content of the empty element with it
- on mouse out, discard the replaced content
I'll load the page up tomorrow.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.