I've got the latest (4.14) CKEditor in a custom CMS. I need to use the config.contentsCss setting to load some custom .css files.
The syntax from Ckeditor docs is:
config.contentsCss = [ '/css/mysitestyles.css', '/css/anotherfile.css' ];
I want to parse a variable instead of a hardcoded path; this is an example from a tpl file (Smarty based CMS):
{$smarty.const.THEME_ROOT}/mytheme/style1.css
Any idea how I can achieve this?
Related
I want to dynamically display a certain server status in an asciidoc (rendered in gitlab)
Something like
:status-server-1: 1
ifeval::[{status-server-1} == 1]
image::green_dot.png[green_dot,20,20]
endif::[]
Now how to dynamically set the attribute?
Is there a way the change the attribute with javascript or similar?
asciidoctor doesn't process JavaScript. It transforms Asciidoc markup to HTML (or other formats). JavaScript only comes into play when the resulting HTML is loaded into a browser.
It would be possible to run a JavaScript program before you run asciidoctor to determine the server status and set an environment variable that could then be used during asciidoctor processing. For example:
STATUS=`node status.js`; asciidoctor -a server_status="$STATUS" <file.adoc>
A different approach would be to use Docinfo files to add custom JS or CSS. Custom JS would allow you to perform an XHR request to discover the current server status and then adjust the classes/styles/images needed to reflect that status.
I've tried searching for how to include a CSS file directly into the template, but none of the answers are very good. I do not want to include the CSS file using <link>, I want to include it directly into the template. I also do not want to read the entire file into a variable and output the variable in the template.
I tried doing it like this
<style>{include "$ROOT_DIR/public/css/all.css}</style>
but then Smarty tries to parse it as a template, which obviously won't work because of the { and } in the CSS file.
I can't put {literal} ... {/literal} around the include, because then Smarty will just output the include command literally. And obviously I don't want to put the {literal} ... {/literal} in the CSS file, since it's not CSS.
I could read the file into a variable and output that in the template, but that seems like a very backwards way of doing things, and probably not very efficient.
Surely, there must be some way to include a file without parsing it as a template?!
Is there a simple way (i.e., without creating an entirely new theme) to customize Sphinx so that it generates HTML pages without the search box?
An alternative, which I discovered reading the alabaster theme documentation is to explicitly list which (if any sidebars) are desired in the conf.py file. For example, including this fragment in conf.py:
html_theme = 'alabaster'
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'searchbox.html',
]
}
produces the searchbox; removing searchbox.html from that list and then building produces the same page but without the box. (More information can be found at the Sphinx documentation for the build-configuration file.)
You can do it by customizing (or should I say disabling) the searchbox template.
In conf.py, add this line:
templates_path = ["templates"]
Create a folder called templates in your Sphinx project directory.
In that folder, add an empty file called searchbox.html. This overrides the default template file (located in sphinx/themes/basic where Sphinx is installed).
I'm trying to display an XML feed in a custom Joomla 2.5 component's view/layout, but the XML is rendered as a regular layout inside the site's HTML template. How can I display the XML without any template HTML code?
(The trick to include tmpl=component in the URL from this related question doesn't help, there's still some HTML output from the template that ruins the XML.)
I would prefer a solution that only involves code changes in my custom component, like in Symfony when you call the method setLayout(false).
The only solution I have found is to create a file in the current template folder, e.g. "xml.php", and put only this in the file:
<?php
$document = JFactory::getDocument();
$document->setMimeEncoding('text/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>
<jdoc:include type="component" />
Then I can append tmpl=xml to the URL.
[edit]
My bad, I made an assumption and you know what that gets you.
Joomla! 1.6->2.5 you can create an alternate output format for an existing view by:
calling the view with a format parameter attached e.g. &format=json
creating a matching view class file e.g. view.json.php that can sit alongside the standard view.html.php file for you view.
The view.yourformat.php file can use your existing controllers and template files in the normal fashion.
Don't forget to add either &tmpl=component or &tmpl=raw to your query string so modules etc don't load as well.
tmpl=raw won't load the html body surrounds or template, only the main component.
[/edit]
From Joomla! 1.6 onward (including 2.5) there is built in support for controller formats ie. you create a controller for the output format you want.
Normally a controller would be named for each view:
/components/mycomp/controllers/myview.php
A XML version of the controller would be name:
/components/mycomp/controllers/myview.xml.php
A JSON version would be:
/components/mycomp/controllers/myview.json.php
To call a particular format version of a controller you simply add &format=theformatyouwant to the URL parameters, so in your case &format=xml
This is discussed in this document from 1.6 days - I used it as a basis for several of our components that have JSON and ics requirements.
This issue drove me crazy a couple of times.
After much frustration, the simplest solution is the one suggested by cppl. In your query
string put the following variables:
format=yourcustomformat
view=viewname
Let say you want json output from a view called json.
Create a veiw folder with the name of your view
json
And a file inside that folder called
view.json.php
Then in your url string you include the following url parameters seperated by the & symbol:
index.php?option=com_mycomponent&format=json&view=json
cppl is correct that this loads a non-html view. However you don't have to put the tmpl parameter in at least in 2.5. If the view name is not view.html.php then 2.5 seems to not include the assigned site template in the response. I think because the view is not veiw.html.php it assumes raw output and does not include the template. I tested this with both an ajax call and a direct url call to the view and in both cases all I got back was the component output. Yeah!
If someone knows where this issue is well documented by the Joomla folks please post!
I just want to add some 'default text' to the fields...
My efforts to edit the PHP have not worked at all !!
I'm guessing that the file to edit is the ' mod_simpleemailform.php '
I cant seem to find the "echo's" that spit out the form...
Am i on the right track...?
Thanks!!
Based on my research this is not a module that comes installed with Joomla! I will answer your question when it comes to properly formated modules.
To find your form go into the folder for your module. In your case it should be /modules/mod_simpleemailform.
This is where the "System" for your module resides. You will find files such as:
mod_simpleemailform.xml This is a configuration file for the module.
index.html This prevents the listing of your module's folder contents.
helper.php This is where your module's functions and brains are located.
mod_simpleemailform.php This calls functions in your helper.php in order to get content and information. Once it has all of its data it will call a template file for the module located in /tmpl of your module's directory.
In here you will find:
index.html It does the same thing as the previous index.html
default.php This is your default template file for your module. This file will contain your form and HTML code that you see on screen.
The default.php is the file that you likely want to use. It is possible that your form is in an other file located in the /tmpl folder so you may have to pick around a little bit.
Usually your fields are not in an echo they are just place on the outside of php tags. You will likely want to add a value attribute and then add some text to it like so <input type="text" name="myField" value="My Default Text" />.
Even better still you could add parameters to the XML file so then you may echo a default text you entered in the back-end of Joomla!.
Just follow on Jonathan's answer, yes, you can find the brain of the module inside of helper.phpand all that you need to achieve your goal: "add some 'default text' to the fields".
Inside the constructor function, you can find the following sentence, that save in $l the name of the current field (because it's inside a loop):
$l = trim($params->get($labelLabel));
you can just add a string with your desired default text (i.e. inside a variable: $myDefaultText):
$l = $myDefaultText . trim($params->get($labelLabel));