joomla article versioning - show version - joomla

Since version 3.2 Joomla has versioning system for content. It can be enabled for articles, but I couldn't find any module or plugin to show article version on frontend and to select previous versions by frontend user. Does anybody know?

Versioning in Joomla is a relatively new feature, and it's not greatly documented. If you're in an article view, then do print_r($this) (in the article view in the template), and you will see all the variables that the article has.
I think $article->version will do (you will need to place this in the article view in the template).
A less elegant solution would be to query the #__content table in the place where you want to show the version number:
$db = JFactory::getDBO();
$sql = "SELECT version FROM #__content WHERE id='".$id."'";
$version = $db->loadResult();

Related

Joomla article structure

I was a newbie in Joomla and using the latest version to create my website. I want to create news page (list of article). I'm using module (external plugin) to listing all the article. But I'm not understand the structure to create the pages.
I got a menu like this:
Home
Latest News (link to single article with category 'Latest News')
This is my category:
Home
Latest News
News (every new article will be under this category)
Events
Then I display all the article inside Latest News page except the page I leave as blank because I using module to display the list. The URL will be like this mywebsitename/latest-news.
The problem is when I click one of the article to show full details of the article. The URL will be like mywebsitename/latest-news/11-home/latest-news/news/articleName. So how I need to do to structure the URL even my breadcrumb to be like this
mywebsitename / Latest News / News / article name
Even the module also display inside the article page. I only set this module under latest news page only. Can anyone help me. Thanks.
If you just began, restart your project. If you want to build up a site, first check whether there are any core functions for your usage or not. If it can be done through them, do it like that, as this is better for updating your site. (Maybe your plugin will not be supported later on...)
Then restart by building up your site:
Category - Article - Menu
Firstly, create the categories you wish. For example, you want the category "News" where you put news articles and a category "Events" where you put articles about your events.
Secondly create some articles for your category. You can use the "read-more" to preview your articles in your blog.
Last, create the menu. You can use a category blog and it's options to show your articles the way you want.

Remove article id from joomla 3.4.8 url

After upgrading my site to Joomla 3.4.8, my URL is showing article id. It was not there before the upgrade.
Can anybody tell me how to fix this problem?
Please help!!
Thanks..
Joomla, by default, includes the article id in the URL in order to avoid problems with articles having the same aliases.
If the previous version of Joomla did not have the article id in the URL, then it might be that you have been using an extension such as sh404SEF and you're not using it anymore.
It might be also that you had a modified core as explained here: http://www.itoctopus.com/how-to-remove-the-article-id-from-joomlas-sef-urls , and the modification was overwritten by the update.

get Joomla sitename in different language

my Joomla have 3 language and I submit sitename for each language in language manager.
I used this to get sitename
$app = JFactory::getApplication();
$sitename = $app->getCfg('sitename');
but this code only give me sitename submitted on General Configuration.
how to get sitename in that language?
Another possible solution (tho not so elegant is to fetch it from database table #__languages, where sitename is stored):
$lang = JFactory::getLanguage();
$db = JFactory::getDBO();
$query = 'SELECT sitename FROM #__languages WHERE lang_code = "' . $lang->getTag() . '"';
$db->setQuery($query);
$sitename = $db->loadResult();
// If no sitename defined - show default sitename
if (!$sitename){
$app = JFactory::getApplication();
$sitename = $app->getCfg('sitename');
}
Try this,
In your case $sitename = $app->getCfg('sitename'); will not work bcoz you are using multi-language Joomla Site.
This option is only for get the values from global configuration.
You can try this,
You have multiple language files available each have a Proper site name consider the constant is SITE_NAME="Your site name";
Then you can simply get your site name like below.
JText::_('SITE_NAME');
Hope its helps..
This is an old post but I wanted to reply because the same process I will outline below is applicable in Joomla 2.5 as well as Joomla 3.x. It does not require any special editing or extensions.
This can easily be accomplished by using Joomla's built in features in the "Language manager". These steps also assume you already have a Multilingual Joomla site up and running. If you need instructions on how to do this you can refer to this link:
https://www.scribd.com/doc/82768844/Joomla-2-5-multi-language-website-without-using-3rd-extensions-in-10-steps
then use the steps outlined below to give your site a custom site name for each language.
The Link above is for Joomla 2.5 but the same steps outlined there can be applied to a Joomla 3.x site.
1) Log in to the administrator section of the site
2) Click on "Extensions"
3) From the Extensions dropdown menu choose "Language Manager"
4) Once in Language Manager you will see the installed languages and these options:
Installed - Site
Installed - Administrator
Content
Overrides
NOTE:
In Joomla 2.5 they will be listed in a row above the installed languages.
In Joomla 3.x they will be listed in a column to the left of the installed languages.
5) Now click on "Content"
6) The name of each language under the "Title" row will now be clickable. Click on the name of the language you want to set the "Custom Site Name" for.
7) Once you have clicked on the language name look for "Site Name". In Joomla 2.5 this will be on the right hand side. In Joomla 3.x this will be in a row above the options.
8) Once you click on Site Name you will see an option that reads "Custom Site Name". Enter the custom site name for that language and it will take priority, essentially overriding what is entered in the Global Configuration.
Please note also that you only need to enter a custom site name for the language that you want to change it for. Example: if your site's main language is English and you have the English version of your site name listed in the Global Configuration and you also have French, Spanish, and German installed then you only need to enter, if you want, a custom site name for the French, Spanish, and German languages.
Something else to consider is that if you need to add a custom site name for the language(s) you more than likely should consider adding custom Metadata for the language(s) such as the "Meta Keywords" and "Meta Description". To accomplish this follow the steps outlined above up to Step 5. Instead of clicking on Site Name you would click on Metadata and enter the language specific customized information for "Meta Keywords" and "Meta Description".
9) Last but not least, and most importantly, after you're all done with the language customizations, Click on "Save" or "Save & Close" to save all your changes.
This new language specific custom site name will be displayed if the site is offline.
Also, for SEO purposes, you can have your site name displayed either before or after the name of the Menu item which appears in the tabs.
That setting can be changed in the Global Configuration options.
Under SEO Settings look for "Include Site Name in Page Titles" and choose either "After", Before, or "No".

How do I transfer items from K2 to Joomla articles or wordpress ? What is the most wise choice?

I feel fed up with the Joomla K2 extension. This is the most crappy extension I've ever used and I am tired of correcting mistakes and bugs all the time. Even in the K2 forums, most of the threads suddenly and strangely disappeared, leading google results to 404 pages.
I did the most foolish thing on joomla: I installed their extension in joomla 1.6 because I wanted to set featured images in every article and joomla didn't have something like that (and then upgraded to 2.5) . So I created a news portal that publishes about 6 articles (or K2 items) every day for a year. So far there are 10 categories, 1000 articles and 200 tags (and 4 users only). There is nothing complicated on the website and all components are used "as they are". I haven't even used K2 extra fields etc.
I desperately want to transfer all items, categories, tags and images from K2 to Joomla articles. Then I will upgrade to the new Joomla 3.0. If I had a choice, I would transfer all data to wordpress. I have no money to hire an experienced developer and I have advanced programming knowledge but I am not an expert. I can try to copy data from one column to another but I would really appreciate the opinion of a developer with a "strong" knowledge.
On Joomla's forums it says that:
K2 articles are stored in the table jos_k2_items. Use a sql query to
copy them to jos_content.
INSERT INTO ###_content (title, alias, catid, published, introtext, fulltext)
SELECT title, alias, catid, published, introtext, fulltext
FROM ###_k2_items ;
This was posted about Joomla 1.5 Check the new table structure and make the necessary changes.
I'm not sure are you still looking for the answer, but maybe others do.
In case you want to move your K2 to WordPress, there's a plugin at the WordPress plugin directory for an automated migration. It supports the import of different type of content including categories, tags, menus and other, so it might answer your request.
The quick guide to the process includes the following steps -
You install the plugin on your WP website
Create the account at the service
Download the extension and install it at your K2 website
Choose the entities you want to migrate
Try the trial migration (it migrates 10 posts)
If you like it you can try the full migration (it's not free)
You may refer to this for more info, plus, this service is also represented in WordPress Codex.
Hope it helps.

How to include javascript in Joomla virtuemart product details

I am actually customizing product details page with the help of http://virtuemart.net/documentation/Developer_Manual/Modifying_the_Layout.html this page. I need to include some external and internal JavaScript.But don't know were to add script.Please some one help me to do this.
To modify product details page . i just worked in following file components/com_virtuemart/themes/default/templates/product_details/flypage.tbl.php.
Virtuemart version is VirtueMart 1.1.9 stable
Joomla Version is Joomla! 1.5.15 Stable
Thanks In advance.
Based on your responses in the comments here is the answer:
//This line defines what JavaScript file you wish to add, change it as needed.
$myJsFile = JURI::Base() . 'templates/my_template_name/js/myJsFile.js';
//this line fetchs the jdocument object which is needed to add items to the head (amongst other things)
$document =& JFactory::getDocument(); //Drop the & if PHP5
//This line adds the previously setup JS url
$document->addScript($myJsFile);
If you want to add or something custom like IE conditional tags then see here for more info: http://docs.joomla.org/Adding_JavaScript_and_CSS_to_the_page on how to use this object.

Resources