Content rotator

About the template and stylesheet - and changing the menu
Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Content rotator

Post by Tata » Wed May 25, 2016 6:16 am

I am working on a new CMSimple_XH template. Here I would like to use newsbox rotator in the header/banner. There was a free version of jerry's plugin newsrotator that would make it. But it's not free since long ago and it doesn't work for me with the latest version of CMSimple_XH. There are also many scripts, CSS-solutions, etc. for the use in a template. But using a template seems to me very comfortable even for beginners. Does anybody know any solution? I mean a plugin that would slide hidden News01... pages in a banner newsbox space.
Maybe extending flexslider's feature by the possibility to have plugin calls inserted as a data source. E.g.:

Code: Select all

{{{flexslider('News');}}} 
where the parameter would be the initial string of newsbox pages names.
Last edited by cmb on Fri May 27, 2016 11:56 pm, edited 1 time in total.
Reason: fixed typo in title
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.

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

Re: Conten rotator

Post by cmb » Fri May 27, 2016 8:23 pm

Tata wrote:Does anybody know any solution? I mean a plugin that would slide hidden News01... pages in a banner newsbox space.
Well, not a ready-to-use solution, but you most likely can use FlexSlider2 (or some similar script) manually. Have a look at the Basic Slider example. You would just have to construct some approrpiate HTML in the template (using newsbox(...)) and embed the necessary scripts/stylesheets.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Content rotator

Post by Tata » Sat May 28, 2016 9:26 am

I have found the old free version of newsrotator on my old HDD. But this seems not to work with new version of CMSimplpe_XH. The debug says:
NOTICE: Use of undefined constant time_correction - assumed 'time_correction'
/Users/msereday/Sites/cmsimplexh167/plugins/newsrotator/admin.php:31
NOTICE: Undefined variable: outuput
/Users/msereday/Sites/cmsimplexh167/cmsimple/functions.php(184) : eval()'d code:1

But I will try to "hardropping" the slider into the template, though.
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.

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

Re: Content rotator

Post by cmb » Sat May 28, 2016 10:30 am

Tata wrote:NOTICE: Undefined variable: outuput
/Users/msereday/Sites/cmsimplexh167/cmsimple/functions.php(184) : eval()'d code:1[/b]
Is the variable really named `outuput`? Most likely it should be `output`.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Content rotator

Post by Tata » Sat May 28, 2016 10:49 am

Yes, it was wrong. But anyway, none of

Code: Select all

#CMSimple $outut.=newsrotator();#
{{{PLUGIN:newsrotator();}}}
{{{newsrotator();}}} 
works. Only the heading of the page with the plugin call is shown without any debug complains, excepet of undefined variable $newsrotator
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.

lck
Posts: 2955
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Content rotator

Post by lck » Sat May 28, 2016 3:41 pm

Ich habe NewsRotator 1.3.1 (letzte kostenlose Version (?)) seit langem auf einer Webseite in Benutzung und es läuft mit CMSimple_XH 1.6.7 zumindest mit dem Plugin-Aufruf im Template.

Code: Select all

<?php echo newsrotator();?>
Ich muss dazu sagen, dass ich auch erst die Tage alle Dateien zu "UTF-8 ohne BOM" konvertiert und Leerzeilen/Leerzeichen am Ende der Dateien gelöscht habe.

Der Plugin-Aufruf auf einer Seite ist erst seit Version 2x verfügbar:
From version 2 NewsboxRotator can also be deployed on single pages:
#CMSimple $output.=newsrotator();#
In this case you may not use it in the template.
Habe die 3 Varianten trotzdem mal in einer Seite getestet

Code: Select all

<div>#CMSimple $output.=newsrotator();#</div> /* <--- Tata, da hattest du einen Schreibfehler ($outut)!*/

<div>{{{PLUGIN:newsrotator();}}}</div>

<div>{{{newsrotator();}}}</div>
Es funktionieren alle 3 Plugin-Aufrufe in der Seite, aber es gibt folgende Probleme:
- Edit-Modus: Editor erscheint nicht mehr!
Erst durch das Einfügen des Plugin-Aufrufes im Template erscheint er wieder.

- Reihenfolge und Dauer der Anzeige der Newsboxes ist in Chrome + Opera + Vivaldi (Chromium) anders als in IE + FF, ca. 1s bis 2s kürzer, egal ob Pluginaufruf im Template oder in der Seite.

Wichtig:
- Es darf nur einen Plugin-Aufruf geben, entweder im Template oder in einer Seite!
- jQuery muss auf "Autoload" und Migrate aktiviert sein
Aber das nutzt ja alles nichts, wenn der Editor nicht mehr funktioniert :roll:

Die Browserkonsole bringt im Edit-Modus die Fehlermeldung:
Uncaught TypeError: Cannot set property 'innerHTML' of null rotate.js:107

Code: Select all

function rotateNews(){
   var len = newsArray.length;
    if (len==0)
        return "";
    if(nIndex >= len)
        nIndex = 0;
    if (modulusidx%2==0) {
      document.getElementById('stories').innerHTML = newsArray[nIndex]; // <-- Zeile 107
       createCookie("newsrt",++nIndex);
  }
  if (len>1) {
       fade('stories');
        modulusidx++;
         timerID = setTimeout('rotateNews()',((modulusidx%2==0)?TimeToFade:TimeToStay));
     }
     else {
        document.getElementById('stories').style.opacity=1;
      document.getElementById('stories').style.filter = 'alpha(opacity=100)';
    }
}
Debug-Mode meldet nur:
NOTICE: Undefined variable: newsrotator
D:\xampp\htdocs\...\plugins\newsrotator\admin.php:13

Code: Select all

//echo "[$newsrotator]";
if($newsrotator){ // <----------------- Zeile 13
  global $sn,$sv,$sl,$pth,$plugin;
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

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

Re: Content rotator

Post by cmb » Sat May 28, 2016 4:04 pm

lck wrote:Ich habe NewsRotator 1.3.1
Die liegt mir nicht vor, daher kann ich im folgenden teilweise nur raten.
lck wrote:Es funktionieren alle 3 Plugin-Aufrufe in der Seite, aber es gibt folgende Probleme:
- Edit-Modus: Editor erscheint nicht mehr!
Erst durch das Einfügen des Plugin-Aufrufes im Template erscheint er wieder.
Wenn der Editor nicht erscheint, liegt es i.d.R. daran, dass die Initialisierung in <body onload> nicht erfolgt. Das kann u.U. daran liegen, dass ein anderes Script in onload einen schweren Fehler verursacht, und dann der Editor eben gar nicht mehr zum Zug kommt.
lck wrote:Die Browserkonsole bringt im Edit-Modus die Fehlermeldung:
Uncaught TypeError: Cannot set property 'innerHTML' of null rotate.js:107
Im Edit-Modus wird anscheinend das Element mit der ID stories (also #stories) nicht erzeugt, aber das JS berücksichtigt das nicht. Man bekommt die Fehlermeldung wie folgt weg:

Code: Select all

if (document.getElementById('stories')) document.getElementById('stories').innerHTML = newsArray[nIndex]; // <-- Zeile 107  
Ob das allerdings das eigentliche Problem löst (sprich der korrekte Bugfix ist), kann ich nicht sagen.
lck wrote:Debug-Mode meldet nur:
NOTICE: Undefined variable: newsrotator
D:\xampp\htdocs\...\plugins\newsrotator\admin.php:13

Code: Select all

//echo "[$newsrotator]";
if($newsrotator){ // <----------------- Zeile 13
  global $sn,$sv,$sl,$pth,$plugin; 
Das ist harmlos, aber man kann die Zeile sauberer so schreiben:

Code: Select all

if (isset($newsrotator) && $newsrotator) { 
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Content rotator

Post by Tata » Sat May 28, 2016 4:08 pm

Vielen Dank für die Eerklärung. Erst jetzt bin ich dazu gekommen, dass - solange es um ein Template geht, die freigegeben sein soll- soll ich lieber keine Plugins nutzen, oder höchstens die, die frei erreichbar sind.
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.

lck
Posts: 2955
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Content rotator

Post by lck » Sat May 28, 2016 4:55 pm

cmb wrote:Die liegt mir nicht vor, daher kann ich im folgenden teilweise nur raten.
Per E-mail unterwegs.
cmb wrote:Ob das allerdings das eigentliche Problem löst (sprich der korrekte Bugfix ist), kann ich nicht sagen.
Gelöst! Editor ist wieder da! :)
cmb wrote:Das ist harmlos, aber man kann die Zeile sauberer so schreiben:

Code: Select all

if (isset($newsrotator) && $newsrotator) { 
Meldung verschwunden! Danke Christoph.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

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

Re: Content rotator

Post by cmb » Sun May 29, 2016 10:12 am

Tata wrote:Vielen Dank für die Eerklärung. Erst jetzt bin ich dazu gekommen, dass - solange es um ein Template geht, die freigegeben sein soll- soll ich lieber keine Plugins nutzen, oder höchstens die, die frei erreichbar sind.
Na ja, auch die Verwendung von kostenpflichtigen Plugins kann sinnvoll sein. Das sollte dann halt deutlich dokumentiert werden. Und es gibt vielleicht auch die Möglichkeit, das Template so zu gestalten, dass die Verwendung eines kostenpflichtigen Plugins optional ist. In diesem Fall könnte man es so machen, dass, falls Newsrotator nicht installiert ist, einfach nur ein Bild angezeigt wird:

Code: Select all

<?php if (file_exists("{$pth['folder']['plugins']}newsrotator")):?>
    <!-- use newsrotator -->
<?php else:?>
    <!-- show alternative content -->
<?php endif?>
lck wrote:
cmb wrote:Die liegt mir nicht vor, daher kann ich im folgenden teilweise nur raten.
Per E-mail unterwegs.
Danke, ist angekommen.
lck wrote:Gelöst! Editor ist wieder da! :)
Prima! Und danke für Deine sorgfältigen Tests. :)
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply