Change Joomla 3 page title and site name separator from '-' to '|' - joomla3.0

how would i change the joomla page title and site name separator from - to |. I know which file generates the file. It's located at C:\xampp\htdocs\Yoursitename\libraries\joomla\document\html\renderer\head.php
$buffer .= $tab . '<title>' . htmlspecialchars($document->getTitle(), ENT_COMPAT, 'UTF-8') . '</title>' . $lnEnd;
I just can't figure out where the getTitle function is coming from.
Thanks

It uses a language constant JPAGETITLE which in english is set to %1$s - %2$s
You can use the language override manager in your Joomla backend to change that.
The title itself is usually set in the view you look at. There JDocument->setTitle() is used. Like for example here for com_content, article view: https://github.com/joomla/joomla-cms/blob/staging/components/com_content/views/article/view.html.php#L256

Related

How to get base url with language in joomla 3.4

Trying to get base url in joomla with language suffix like http://localhost/projectname/en
We can easily get http://localhost/projectname/ by using JURI::base
how to get project url with language like
http://localhost/projectname/en
echo $this->baseurl . $this->language;
==> this would give full name of language for ex,en-gb
to avoid this use
if ($this->language == "en-gb")
{
$sef = "en";
}
echo $this->baseurl . $sef;

Different coding sets in database and website

I have a website with very simple news system (posting, editting, deleting etc). All my html pages are saved in UTF-8 formatting, everything displayes correctly.
I specify using UTF in every header:
For saving news to database, I use simple scripts like (all values come from a html form):
$newsTitel = isset($_POST['title']) ? $_POST['title'] : 'Untitled';
$submitDate = $date = date('Y/m/d');
$content = isset($_POST['newstext']) ? $_POST['newstext'] : 'No content';
include 'includes/dbconnect.php';
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES 'utf8'");
$query = mysql_query("INSERT INTO news SET date='$submitDate',subject='$newsTitel',news='$content'");
The data get saved to database but in a weird format (coding). There are characters like à ¡ Ä etc which makes the content almost unreadable. Other problem is that when loading this content back to html forms (for editting news) it displays in this weird coding. When I looked into the specification of the database I use, it says that it saves data in UTF-8.
I use phpMyAdmin to access the MYSQL database.
So to sum it up:
Pages: saved in UTF8, all have correct header
Database: interaction with the server: utf8_czech_ci, tables in the same format
What I do not understand at all is this strange bevaior:
1) I save the data into the database using the script above
2) I take a look into phpMyAdmin and see broken encoding
3) I load the data back into my website and display them using this:
<?php
include 'includes/dbconnect.php';
$data = mysql_query("SELECT * FROM news ORDER BY id DESC limit 20") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
echo '<article><h3> '.$info['subject'].'</h3><div id="date">'.$info['date'].'</div>';
echo '<p>'.$info['news']. '</p></article>';
}
?>
The encoding is correct and no weird characters are displayed.
4) I load the exact same data into a html form (for edition purposes) and see the same broken encoding as in the database.
What happened? I really dont get it. I tried fixing this by re-saving everything in utf8, alterign tables and changing their encodings into different utf8 versions etc...
This is example of a data I pass to the database (it is in czech with html tags):
<p>Vařila myšička kašičku</p>
<img src="someImage.jpg">
<p>Další text</p>
Thanks for any help...
The commands for specifying the character set should be:
set names 'utf8';
If you check the result returned from your queries at the moment, what does it say? If I try it in the monitor I get the following:
mysql> set names 'UTF-8';
ERROR 1115 (42000): Unknown character set: 'UTF-8'
Have you tried using set names 'utf8' before connecting for the SELECT as well? The characters you're saying are output make me think you're getting back the correct bytes for UTF-8, but they're being interpreted as ISO-8859-1.
You are not escaping single quotes or some other html chars.
Use mysql_real_escape_string.
$newsTitel = isset($_POST['title']) ? mysql_real_escape_string($_POST['title']) : 'Untitled';

require command issue in CakePHP

I have a library in my project.When I want to use this with this code:
require('../Plugin/Utils/DateTimeUtil.php');
it says no such file exists. my cakephp 1s 2.3 what should I do?
The Routing in cakephp is different from pure php.I had something like this.At first you should find the path Plugin folder with this code
$pluginPath = App::path('Plugin');
Then It returns an array which contains the plugin folder's path in 0 index.So you should the returned value like blow:
require($pluginPath[0] . 'Utils' . DS . 'DateTimeUtil.php');
You can use slash instead of DS. DS is DIRECTORY_SEPRATOR.

Translate Month-Day combinations in CakePHP

I can translate an individual month or day just fine using my .po files:
echo __('December'); //becomes diciembre
echo __('Thursday'); //becomes jueves
//...etc
But, when I use a date formate like this:
echo __(date("j F, Y")); //becomes 20 December 2012
It doesn't translate - I assume because I have translations for each month and day in individual lines.
Normally I would just do something like this:
__(date('j')) . ' ' . __(date('F')) . ' ' . __(date('Y'));
But, in the CMS, the admin is allowed to change the date to any format they want. So, it could be "j F, Y", or "Y-m-d", or... anything else.
I thought maybe I could make a helper or something, that broke apart a date into pieces, and returns each part in a __(), but - this seems overkill. Is there an easy way to do this?
I am setting my locale in the AppController:
setlocale(LC_ALL, $currentLanguage['locale']);
Configure::write('Config.language', $currentLanguage['code2']);
Turns out CakePHP has a TimeHelper i18nFormat function:
$time = time();
$timestring = $this->Time->format('Y-m-d H:i:s', $time);
$this->Time->i18nFormat($timestring, "%A %e %B %Y");
Create a file "LC_TIME" (no extension) and put it in your /Locale/ara/ folder (or replace 'ara' with whatever 3-char language code you want)
Copy the contents of CakePHP's time_test LC_TIME file and put it into yours (then save of course).
Then change it's contents to whatever language you want (I believe that example is in Spanish).
That's it!
Notes:
More details about the LC_TIME file here: http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.files%2Fdoc%2Faixfiles%2FLC_TIME.htm
The CakeTime class (and thus the TimeHelper) uses the 'cake' domain for day and month names translation. So put those translations in cake.po file instead of default.po

How to print username as path in Drupal 7

I'm trying to give every registered user a unique url shown on their user page which they can copy and paste...promoting their page.
I had this working using Pages and Tokens...but now I've ditched Panels/Pages for a custom user-profile.tpl.php
I've tried this:
print ($user->name);
But this returns the user name as Hillay Swag instead of hillary-swag
How can I print the url version of the user name instead of the human version?
$link = drupal_get_path_alias('user/' . $user->uid);
print $link;
That will print out users/admin. Further, if you only want the username part of the path (no users/) you could cut it with PHP's substr() function.

Resources