Admin's hints in content

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

Admin's hints in content

Post by Tata » Fri Jan 13, 2017 3:14 pm

It would be very usefull, if there would be a possibility to drop some "admin hints" directly into the content of a webpage. I think about this idea since some clients required repeatidly explanation what the commands/calls written on a page do mean. In this case I would prefere something like this:

Code: Select all

<h1>Heading</h1>
<div class="hint">Following script calls the function "imgalbum('parameter's)". 
It requires the name of the folder with images to be shown in the album.
DONT TOUCH THIS SCRIPT!</div>
{{{imgalbum('event2016');}}} 
I just don't know how to style these hints to be shown only in a backend.
In admin view mode it should the look about like this:
Heading
Following script calls the function "imgalbum('parameter's)".
It requires the name of the folder with images to be shown in the album.
DONT TOUCH THIS SCRIPT!

{{{imgalbum('event2016');}}}
This way many headaches would be avoided :D
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: Admin's hints in content

Post by cmb » Fri Jan 13, 2017 3:51 pm

Tata wrote:I just don't know how to style these hints to be shown only in a backend.
Consider that even if it were possible to set display:none (or similar) for these hints, in the best case search engines would catch the hints, and in the worst case they might punish the website for containing invisible text.

The only clean solution would involve some server side scripting, stripping the hints in view mode, or perhaps to embed the hints as HTML comments and to configure the editor to show HTML comments (not sure if that's supported by TinyMCE or others). However, the latter case could leak sensitive information, so the former approach would be preferable, anyway.

Instead of such hints, I would suggest something like the Plugin-Aufruf-Editor, and to tell unexperienced users to avoid changing anything inside {{{ and }}} manually (if at all).

Anyhow, see also https://cmsimpleforum.com/viewtopic.php?f=29&t=8322.
Christoph M. Becker – Plugins for CMSimple_XH

frase
Posts: 5085
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: Admin's hints in content

Post by frase » Fri Jan 13, 2017 4:15 pm

Eine Idee:
Plugin Glossaire_XH installieren.
Als Begriff "{{{imgalbum" festlegen.
Dann erscheint nur im Adminmodus der Erklärungstext.


Sorry, da habe ich wohl zu schnell geantwortet.
Das klappt nicht.
:oops:

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

Re: Admin's hints in content

Post by Tata » Fri Jan 13, 2017 5:11 pm

Hahoooo!
Es geht ganz gut mit coco_XH. Obwohl nur gemeinsam fúr alle Aufrufe auf der Seite.

Code: Select all

<?php if($adm=="true"){echo '<div class="hint">'.coco('my_content').'</div>';}else{echo '';}?>
macht den Trick. Jetzt nur noch stylen.
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.

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

Re: Admin's hints in content

Post by Tata » Fri Jan 29, 2021 9:46 am

Ich wollte jetzt auf einer Webseite auf gewissen Seiten im Editor dem Admin kleine Hinweise anzubieten. Dafür wollte ich die simpleplugins_xh von utaka nutzen. Das zerschießt aber die Seite, meldet Fehler und schaltet Debug mode ständig ein (lässt sich dann nicht ausschalten). Funktioniert aber nicht.
Es würde entweder die simpleplugins_xh anzupassen, ader etwas anderes versuchen.
Wie würdet ihr so etwas lösen?
You do not have the required permissions to view the files attached to this post.
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: 2963
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Admin's hints in content

Post by lck » Fri Jan 29, 2021 1:33 pm

Tata wrote:
Fri Jan 29, 2021 9:46 am
Wie würdet ihr so etwas lösen?
Möglich wäre das per CSS.

Beispiel, Seite "Test".
H1 mit einer spezifischen Klasse versehen (oder auch, ein div mit der Klasse vor h1 erstellen):

Code: Select all

<h1 class="tooltip-Test">Test</h1>
in der stylesheet.css am Ende einfügen

Code: Select all

#tinymce h1.tooltip-Test:before {
	background-color: #9E9E9E;
	color: #fff;
	content: "Tooltip für die Seite Test.";
	display: block;
	font-size: 1rem;
	padding: 0.25em 0.5em;
	position: relative;
	z-index: 9999;
}
Der Hilfetext wird dann im Editorfenster oberhalb der h1 angezeigt. Man könnte diesen auch absolute oder fixed positionieren.

Ist halt nicht sicher vor unbedarften Änderungen seitens des Admins. Wenn er die Klasse löscht, ist kein Hinweistext mehr zu sehen.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

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

Re: Admin's hints in content

Post by Tata » Fri Jan 29, 2021 3:10 pm

Hallo,
das habe ich am Anfang auch genau so versucht. Ist aber wirklich nicht so sicher und praktisch.
Sieht so aus, dass ich weiter mit morepagedata bleibe, obwohl da ein Plugin mehr zu installieren ist (wegen "Hints" auf 3-4 Stellen manchmal "mit Kanonen gegen Spatzen"), aber doch sehr bequem mit z.B.
1. Im Plugin einstellen
Screenshot_2021-01-29 ALLDATA –.png
2. Auf der jeweiliger Seite definieren
Screenshot_2021-01-29 ALLDATA – Oznam.png
3. Im Template sichbarkeit einstellen

Code: Select all

<div class="content-inner">
	<?php if(XH_ADM && $edit && strlen($hint)> 0){echo '<div class="hint">'.$hint.'</div>';}else{echo '';}?>
	<?php echo onepage_content();?>
</div>
ist es ganz bequem.
You do not have the required permissions to view the files attached to this post.
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: Admin's hints in content

Post by cmb » Fri Jan 29, 2021 9:19 pm

Alternativ zu Morepagedata könnte man das auch mit Yanp_XH machen.

Direkt per CMSimple-Skripting geht es nicht, da dieses im Bearbeitungsmodus nie ausgeführt wird.
Christoph M. Becker – Plugins for CMSimple_XH

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

Re: Admin's hints in content

Post by Tata » Fri Jan 29, 2021 9:49 pm

Hm, nachdem Yanp_XH installiert ist, bekomme ich
DEPRECATED: Function create_function() is deprecated
/Users/msereday/webpages/dermalauta/plugins/yanp/index.php:180
Außerdem (mit one_page wohl logisch) stehen alle Hints über dem Editor mit jeder Seite.
Im Template

Code: Select all

<?php if(XH_ADM && $edit){echo '<div class="hint">'.yanp_newsbox().'</div>';}?>
<?php echo onepage_content();?>
Etwa:
Seite 1
Hint 1 Mehr...
29.01.2021
Seite 2
Hint 2 Mehr...
29.01.2021
Seite 3
Hint 3 Mehr...
29.01.2021
...
[EDITOR]
Seite 4
Lorem ipsum...

Mit morepagedata stört nur bißchen, dass XH_debug meldet
NOTICE: Undefined variable: hint
/Users/msereday/webpages/dermalauta/templates/dermalauta/template.htm:162
wenn kein Hint auf einer Seite gegeben wird.
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: Admin's hints in content

Post by cmb » Mon Feb 01, 2021 11:06 pm

Tata wrote:
Fri Jan 29, 2021 9:49 pm
Hm, nachdem Yanp_XH installiert ist, bekomme ich
DEPRECATED: Function create_function() is deprecated
Oh, ja Yanp_XH 1pl5 ist alt; im master Branch war das schon lange gefixt, und ich habe am Wochenende noch weiter daran gearbeitet, aber für 2.0 reicht es noch nicht.
Tata wrote:
Fri Jan 29, 2021 9:49 pm
Außerdem (mit one_page wohl logisch) stehen alle Hints über dem Editor mit jeder Seite.
Im Template

Code: Select all

<?php if(XH_ADM && $edit){echo '<div class="hint">'.yanp_newsbox().'</div>';}?>
<?php echo onepage_content();?>
Das hat nichts mit Onepagern zu tun, sondern damit, dass Yanp_XH hier eigentlich zweckentfremdet wird, und von Haus aus keine passende Funktion enthält. Versuche mal folgenden Code im Template:

Code: Select all

<?php if (XH_ADM && $edit && isset($pd_current['yanp_description'])) echo $pd_current['yanp_description']?>
Tata wrote:
Fri Jan 29, 2021 9:49 pm
Mit morepagedata stört nur bißchen, dass XH_debug meldet
NOTICE: Undefined variable: hint
/Users/msereday/webpages/dermalauta/templates/dermalauta/template.htm:162
wenn kein Hint auf einer Seite gegeben wird.
Eigentlich passt Morepagedata für deinen Anwendungsfall auch besser, weil es eben nicht so spezialisiert ist wie Yanp_XH. Also für Morepagedata:

Code: Select all

<?php if (XH_ADM && $edit && isset($hint)) echo $hint?>
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply