Elements overview
WebYep elements are little fragments of PHP code, that are embedded in the page's HTML code. You can insert them using any code or web page editor that allows inserting PHP code. See the reference for each WebYep element for details.
You can format WebYep Elements within your page in the same way as any other item, whether that be text or images. For example, you can format a WebYep Short Text Element like any other regular text, by using CSS.
Important: Please remember that pages that are to contain WebYep elements must have their filename extension set to '.php' instead of '.html' or something else.
The anatomy of elements
It's not essential to know how WebYep elements work, but you may be interested to learn the basics of what the code does. As is often the case with most PHP code, we start with opening and closing tags:
<?php ?>
Then we enter the name of the WebYep function we want to call, a pair of brackets and a closing semi-colon:
<?php webyep_shortText(); ?>
Inside the brackets, we add arguments. These are data values (strings, booleans and numbers) that get sent to WebYep on the backend, containing instructions like the fieldname, whether this a global block or not and the preferred size of the editor window:
<?php webyep_shortText("Fieldname", false, 550, 240); ?>
Then WebYep knows what editing interface to show and loads the correct content (if content was previously added).
Sometimes you will see comments added to WebYep elements like
// WebYepV2
or // WebYepV3
. These are
entirely optional and are simply there to denote what WebYep version
the element was first shipped in. Over time, the number of WebYep
elements has increased and the choice of arguments in the function
calls have changed. Hence some are marked in this documentation as
'obsolete'. So these comments are provided just to help keep-track of
things.
To maintain tidy code, you will often see WebYep developers consolidate elements onto a single line like this, as is often shown in this user guide:
<?php webyep_shortText("Fieldname", false, 550, 240); // WebYepV2 ?>
Elements like the Loop are a little more involved in their structure, because they include 'foreach' functions and need to set sessions. So the above is mostly applicable to the simple elements.
Summary
- WebYep elements are small blocks of PHP code.
- Simple elements comprise of a function name and pass a set of arguments within brackets.
- Pages containing WebYep elements need the filename extension '.php' instead of '.html'.
- You can format WebYep elements like any other content in your page (e.g. placing them inside HTML tags or styling them via CSS).