How language data is sent to the view file in OpenCart 3? - opencart

I have no idea how it works in new version in open cart . Previosly all language data directly filled into controller array $data pass into view file , but now in controller just load a language file and I can't understand how data from language file send to template file . Help please

In OpenCart 3, the language variables are auto loaded into the controller. You don't need to declare the variables by yourself.
So you can add a new variable into the language file (catalog or admin) and then use it directly from your twig view.

Related

Create new language in mid-project

Was requested by the client a new language to add to the project in sitecore. I'm having some issues with that,
I've created the language, however all the renderings are empty for the new language.
There's no version assigned to any item for the new language also.
I tried to do a trick that was to export the English language and open the generated xml file and rename the tags , to the requested language and then import. But when I'm trying to import it, shows as I was importing English language and not the new one.
How can I create a new language with all the renderings and content (even if it goes to english when empty string, I know it's default procedure) ?
Thanks
You can use Powershell script for that.
See e.g. this blog http://www.coreblimeysitecore.com/blog/create-language-versions-using-sitecore-powershell/
Sample code is
Add-ItemLanguage -Path "master:\sitecore\content" -Language "en" -TargetLanguage "de-AT","de-de","en-za","fi-fi","fr-be","it-it","pl-pl","ru-ru","sv-se","fr-fr" -IfExist OverwriteLatest -IgnoredFields ""
And here is a very similar question on http://sitecore.stackexchange.com site:
https://sitecore.stackexchange.com/questions/1584/create-new-language-version-for-content-branch

Recover hybrid page Alfresco Share

I've created a new page Aikau, but I changed the XML file and the rendered page content between the standard Share header and footer disappeared.
In this page, I want the arguments of the query string, so I write this code:
page.get.desc.xml:
<webscript>
<shortname>My New Page</shortname>
<url>/hdp/ws/my-new-page</url>
<authentication>user</authentication>
</webscript>
page.get.js:
function main ()
{
// Get the args
var fileProp = args["test"];
model.temp = fileProp;
}
main();
page.get.html.ftl:
Test arg: ${temp}
I have to put /hdp/ws/my-new-page in the XML file to write the content of FTL file in this page... But why did the header and footer of the Alfresco template disappeared ? hdp serves for this purpose. And if I don't put the URL like that on the XML, the page appears with the template.
What is wrong in my code? Or how can I recover the template? Or add header and footer?
EDIT: I already try to put only /my-new-page without /hdp/ws/ but the args are null when I put /hdp/ws/. Give me a hint.
EDIT2: I already try to import alfresco-template.ftl but I can't. Any idea?
You don't actually need to include the the "hdp/ws" part in your WebScript descriptor. Only the "/my-new-page" is required. Aikau attempts to simplify the Surf page creation by providing a number of pages out-of-the-box (and the "hdp" page is just one of them).
Aikau uses URI-template mapping to match a single WebScript to a page, so for example in the URL:
/share/page/hdp/ws/my-new-page
share = application context
page = Spring MVC request dispatcher
hdp/ws/my-new-page is then mapped to the URI template:
<uri-template id="share-page">/{pageid}/ws/{webscript}</uri-template>
Where "hdp" is the id of the page to render and "my-new-page" is the WebScript URL. The HDP page uses the "webscript" token from the template to automatically create a new Surf Component and bind it to the WebScript.
But in short - don't include "hdp/ws" in your WebScript URLs for Aikau pages.
You need to make the things that you have on javascript server in this javascript mandatorily? If not, you can create a javascript client that receive the same arguments (location.search give to you the query string, so, you can make parse of that query string and get only the value of the "test" that you want) and call them on FTL file (the client-side javascript). So, when the page loading, it does not lose the arguments. It isn't the best solution but you can try this...

How do I create text file for Confluence and then import it as a Confluence wiki page?

Here is what I want to accomplish:
I am writing a script which will parse some source code, extract some comments that I want it to extract and I will store this text in a text file.
I want to write another script that uses the content of this text file to be programatically transformed into a Confluence wiki-page.
Please tell me the best way to do this. I already saw this
I felt that I could change the input in the above example to take input from text file and update contents of Confluence page. But, I am not sure how it will be formatted. If I have to format it, what do I need to do?
Thanks in advance!
As an alternative to XML-RPC you can use the integrated WebDAV plugin.
Write a script that creates a directory in the selected space.
The directory name will be the page name. After creating the directory a text-file with the same name (with .txt extension) will be created in the directory which holds the content of the page
let your script edit this file in insert the content of your text-file.
Information about the usage of the plugin:
Configuring a WebDAV client for Confluence
Confluence WebDAV Plugin
Troubleshooting WebDAV
I Also saw the code you are referring to. I tweaked it a bit a produced the following code that me help you for the second part of your question.
My code creates a new space and also a new page from a text file that is inserted in the previously created space.
import sys
import xmlrpc.client
import os
import re
# Connects to confluence server with username and password
site_URL = "YOUR_URL"
server = xmlrpc.client.ServerProxy(site_URL + "/rpc/xmlrpc")
username = "YOUR_USERNAME"
pwd = "YOUR_PASSWORD"
token = server.confluence2.login(username, pwd)
# The space you want to add a page to
spacekey = "YOUR_SPACENAME"
# Retrives text from a file
f = open('FileName.txt', 'r')
content = f.read()
f.close()
# Creates a new page to insert in the new space from text file content
newpage = {"title":"NEW_PAGENAME", "space":spacekey, "content":content}
server.confluence2.storePage(token, newpage)
server.confluence2.logout(token)
For your formatting issues, html is supported, but I have not quite figured out how to use CSS styles other than inline (everthing else does not seem to work).
These styles work when you write them with the HTML macro inside Confluence, but from the remote API, it does not seem to behave the same way.
UPDATE :
You can use the {html} macro to include your html by using :
content = server.confluence2.convertWikiToStorageFormat(token, content)
You can also specify your CSS in your global CSS stylesheet.
Another option is to develop a plugin to include a CSS resource :
https://developer.atlassian.com/display/CONFDEV/Creating+a+Stylesheet+Theme
I have tried this way and works petty well for me:
I used a Java program to created a programmatic client to create the dynamic content. This created a HTML document out of my plain text.
I used a RPC client connected to Confluence to uploaded it as a new page.
Your html will be preserved. But if you want to add CSS or JS/JQuery etc on top of your html you will need to create a Macro and enable it for the Particular page. This feature is not available in Confluence OnDemand.

Collaboration between files using jumi in joomla 2.5

I am a beginner php and joomla user. I have installed jumi component in joomla 2.5. I want to collaborate between pages but I don't know how to link between them. Can anyone please help me by explaining briefly.
Such as I have created a new file in jumi named "linked to another article" and the codes are explained below:
I have defined them:
defined("_JEXEC") OR die ("Restricted access");
I have created a link:
$linktext = "<Click> & you'll see";
After that I put the href:
<a href="FILE PATH"><?php echo htmlspecialchars($linktext);?>
After that I have created another file in jumi named "ABC" where I put <?php echo"Hello World"?>, how can I include the path of ABC file in the "FILE PATH" of my first file so that if I click on the first files link then it will redirect me to my ABC file and show "Hello World"?
I will be grateful for your kind reply.
Thanks.
Let's suppose you have 2 files in the jumi directory (components/com_jumi/files). A.php and B.php.
We don't want people to be able to access those files directly, so we place inside them the snippet
defined("_JEXEC") OR die ("Restricted access");
So far so good. Assuming that your website's URL is h**p://www.example.com, you'll get a
restricted access if you try any of the bellow:
h**p://www.example.com/components/com_jumi/files/A.php or
h**p://www.example.com/components/com_jumi/files/B.php.
This means that you cannot use those URLs to access for example B.php from A.php.
So here is a workaround:
Create 2 jumi applications from your administration panel, one for A.php (let's call it Application_A) and one for B.php (let's call it Application_B). I supose you have already done that.
Create a menu item of type Jumi application, point it to Application_A and use as its alias the application_a. From this point A.php its accesible as h**t://www.example.com/application_a
Create a new Joomla menu (you can call it hidden for clarity), and in that menu create a menu item of type Jumi application, point it to Application B and use as its alias the application_b. From this point B.php its accesible as h**t://www.example.com/application_b
So. whenever you want to access B.php from A.php you can do it simply as
Go to B

Adding views/blocks programatically to tpl.php files in Drupal 7

I am trying to integrate the awkward showcase into my page--front.tpl.php. My first idea was to create a custom content type (slideshow image) and then a view that prints a list of those images. I was able to create the view and set it to be available as a block... but I have no idea how to include that block via my .tpl.php file. I don't want to just use the content region because it displays a bunch of "hello welcome to $sitename" messages that I couldn't figure out how to remove.
Also, what is the naming convention for views blocks? The machine name for the view I want to create a template of is called 'front_page_slideshow'
There's a way of adding views programatically,
the easiest way is using "views_embed_view()" http://api.drupal.org/api/views/views.module/function/views_embed_view/7
$view = views_embed_view('view_name', 'display', $args);
print $view;
For render a block (any kind of block) use this simple script I created:
https://gist.github.com/4001153
I would create a region['slideshow'] in your template. Then you assign the view that you've already created into it as a block. If you want to get really simple, till you figure how to drupal properly, you can just hack your page--front.tpl.php file and use include('yourslideshowfile.php'); to simply include your file there.