how to add a new modulo position on a joomla template? - templates

i'm using a joomla template called decayed and it doesn't have the right position, only the left one and nothing more.
i would like to add a right and a button positions on that template. how can i do it?
cheers

Assuming you're using joomla 1.5, go into the template directory (/templates/someTemplateName/). I don't know anything about this theme, but if it follows the standard scheme for a joomla template, then modify these two files:
1) index.php
<jdoc:include type="modules" name="myModulePosition" />
Add that wherever you want your module to appear in the template (and substitute "myModulePosition" for what ever you want the module position to be named).
2) templateDetails.xml
Find the xml tag , should probably look something like this:
<positions>
<position>left</position>
</positions>
And add a new tag with your new position, such as:
<positions>
<position>left</position>
<position>myModulePosition</position>
</positions>
That way, your module position will show up in the list of available positions when you're adding/modifying modules.

scott solution may not work at all.
I simply do this by going to DB find module in #__modules table and add in the field "position" the name of desired position, It is hard way but it work's well

Related

Drupal 8 Webform: how to display text input on one page on the next page?

I am trying to develop a multistep webform in Drupal 8 using Webform 8.x-5.1. I have written a WebformHandler that extends Drupal\webform\Plugin\WebformHandlerBase and made it available to the webform.
In the first step of the webform, I collect a text-field. I would like to display the value of that text-field in an HTML element (Advanced HTML/Text or Basic HTML) on the second page after doing some computation.
I have overwritten submitForm() in the WebformHandler and in it assign the value I want to the HTML element as follows:
$form['elements']['page_name']
['advanced_html_element']['#text'] = '...my HTML...';
Using ksm() I can see that this assignment works, but the the HTML element is not rendered with my HTML: the element is either invisible or contains the initial value set up in the form editor.
Clearly I'm missing something. Should I be using something other than submitForm? Can anyone help me?
It's been a long haul, but I've finally worked out how to do what I want to. The following works for me.
Firstly, I discovered the method validateForm in WebformHandlerBase. On each page in a form with multiple pages, you will find that the following methods are called in the order given here:
submitForm (called once)
alterForm(called possibly more than once)
validateForm (called once)
The name validateForm leads me to believe I may be misusing this method, but that is where I set up the elements on the following page that I wish to programmatically initialise. It works, so what the hey!
In validateForm, I initialise the elements that appear on the following page as follows:
$form_state->setValue(<element name>, <data structure>);
The <element name> is the name you give the element in the form editor ("Build" tab). The <data structure> has to be correct, of course: I suggest you find the appropriate structure by first filling in the element on the next page manually and seeing what turns up in $form_state.
There is also a $form_state->getValue(<element name>), which seems to me to mean that $form_state can also be used for storing session data, say in hidden fields. I initially used Drupal::service('tempstore.private')->get('xxx') for storing data that had to be available across page boundaries, but $form_state might be a cleaner solution.
I hope this helps someone: I spent a horribly long time trying to get this to work.

joomla: customize text in user menu

In the user-menu module, I want to change the text in the div.login-greeting element (which is a child of the form#login-form element).
Right now, it says "Hi Steph," (supposing the username is Steph)
I want it to say "Hi, Steph".
That's all.
I can't figure out if what I need to do is a template override or something else... because I can't figure out where the heck these elements come from. I am fairly new to Joomla, and intermediate in php. I've found working with the module manager, adding class suffixes, placing module positions in index.php, etc. all quite straightforward. I did a template override for the login module, with no trouble. But the menu module is baffling me. Looking at the default.php, I can't even figure out how it puts the form in there when it's a user-menu and not just a normal menu. Where does this form come from?? How can I change it???
Go to language>en-GB>en-GB.mod_login.ini and change MOD_LOGIN_HINAME="Hi %s," to MOD_LOGIN_HINAME="Hi, %s" and save the file.
EDIT
If you need to change more strings it's better to create a file en-GB.override.ini inside language/overrides and put only the strings that you want to override from any extension. For example it might contain only:
MOD_LOGIN_HINAME="Hi, %s"
MOD_LOGIN_REGISTER="Click here to register"

woocommerce advanced templating

i´m developing a theme and for some reason i need to move the default position for breadcrubms (also for many other things) over woocommerce themes. Then i realised to do something like this on my functions.php:
function woocommerce_remove_breadcrumb(){
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
}
add_action('woocommerce_before_main_content', 'woocommerce_remove_breadcrumb');
function woocommerce_custom_breadcrumb(){
woocommerce_breadcrumb();
}
add_action( 'woo_custom_breadcrumb', 'woocommerce_custom_breadcrumb' );
And then on any template file, output the breadcrumb just with:
<? do_action('woo_custom_breadcrumb'); ?>
And works. My question is more than that. Is this the correct approach for something like this? I mean for anything over woocommerce, not just breadcrumb, for any pice, ratings, titles, buttons, sidebar, and so on.
What i´m thinking on is why woocommerce templates don´t come with more deep code. I mean, why there´s no such a single-content-loop.php template where you can just change the order of things, title, category, content, images, etc. in an easy way rather that hooking into functions?
I think that is an acceptable way to call the breadcrumbs explicitly. Sometimes it is easier to call a specific function than remove everything around it!
As for changing the order of things and getting into advanced customization; there isn't a single file, but a number of files working together. Create a folder in your themes root called 'woocommerce' and copy the following files for a safe override:
woocommerce/woocommerce-hooks.php:
Here are your hooks, including the ones you are overriding in your themes functions.php. Here is where you can experiment with removing and repositioning certain elements on your product page. Search for 'Sidebar' and you will see where the 'woocommerce_sidebar' action is added with the function it references in...
woocommerce/woocommerce-template.php:
Here are the functions used in template files to output content based on conditional statements. For instance, search for the 'Single Product' series and you can see which template files are used for which functions. For instance 'woocommerce_template_single_title' uses 'single-product/title.php' - if you copy over this folder and file you can make very specific edits to just the title section
Between these two files and their accompanying references (like title.php) I believe you can do the things you described. Let me know how it works out! I'm new to woocommerce too!

Assign/call a page inside umbraco template

I have a page that has 3 sections... left top, left bottom and Right Column. It uses a masterpage from master template... how would I call three different page to fit in these three sections... For now I harcoded left-top section, but I should be able to edit all these three section from umbraco without having to change any code... basically I created three pages, so that I can insert them to respective sections, but I am not sure how to call them from the templates.
I tried this on all three sections... but it only allows me to edit one section
<umbraco:item id="Item1" runat="server" field="bodyText"></umbraco:item>
Is there a way, where I can call "mypage" using ?
I did this with a master macro which calls the razor scripts with a DynamicNode as param.
foreach(DynamicNode child in Model.GetChildrenAsList)
{
#RenderPage("script name here", new DynamicNode(child.id)) // this lets the next script us Model too
}
To get the script name I made a static class that compares the .NodeTypeAlias with a list of constants and returns the script path. This way when ever you change something in the tree it will call it differently on load.
You can add as many params as you want in order to play about with the css or structure for example.
Hope this helps.

Using modules in Joomla K2 Sub-templates

I have a quick question connected with my little knowledge of Joomla\K2. I'm using subtemplates to create different layouts for different pages. When I declare module position on sub template:
<jdoc:include type="modules" name="position-7" />
Nothing happens. I've tried the same code for main template file and it worked, but seems like it's not parsed for sub-templates. Am I right? How can I include modules into sub-templates then?
thanks in advance,
Michael
jdoc tag only works in joomla core template. If you want to load modules of specific position in your k2 subtemplate write the following code at your desired location in that subtemplate.
$module = JModuleHelper::getModules('xxxx');
// xxxx is any virtual position, no need to create it anywhere.
echo JModuleHelper::renderModule($module[0]);
replace xxxx with your desired position name.