Joomla global options SEF - joomla

How to get global options SEF of Joomla 3? Searching whole day nothing found.
This is for Joomla 1.5 need same on 3rd
$config =& JFactory::getConfig();
echo 'Site name is ' . $config->getValue( 'config.sitename' );

In Joomla 3.x, JRegistry::getValue() has been removed, so Use JRegistry::get() instead.
So in a nutshell, here is the code you need to use:
$config = JFactory::getConfig();
echo 'Site name is ' . $config->get( 'sitename' );

Related

In Codeigniter 4, the URL with 'www.' is not shown in base url()

In Codeigniter 4 URL with www. not shown www in base URL().
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://". $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
This source code is also not working.
How can I solve this?
base_url([$uri = ''[, $protocol = null]])
Returns your site base URL, as specified in your config file. Example:
<?php
echo base_url();
Define your base URL in your .env file at the root of your project. Example:
app.baseURL = 'http://www.your-domain.com'
when you first setup a codeigniter project you will see a env file in your root, copy that file and rename it to .env env with a dot.
Then in that folder look at line 23 I think or just look for #app.baseURL = 'http://localhost:8080/' Then Remove the hash(#) and just add www. in front of localhost like this app.baseURL = 'http://www.yourdomain.com/'
Also Remember to change your $baseURL in app\Config\App.php to your domain.
FYI:
What is a .env file?
A .env file or dotenv file is a simple text configuration file for controlling your Applications environment constants.
I recommend you look at the codeignter official docs aswell

Overriding joomla session variables for form handling

I have a joomla website with plethora theme. This is the link to the website where I'm facing problems. http://miraghotels.com/joomjob/membership/planadd?step=2
The form on this link is processed somewhere and an array of variables referring to the form fields and their values is stored in the Joomla session. The problem is that I want to change/override the value of a parameter which is actually in the array variable of the session. To explain this, I'm attaching this code.
$planChosen = $session->get('planChosen', 0, 'register');
First of all, what syntax is this session following? I get a different ouput from just
$session->get('planChosen').
Ok now, when I ouput this variable($planChosen), I get the following output:
Array ( [planname3] => Basic
[planperiod3] => 15 Days
[plancredit3] => 5
[price3] => 0
[plan_id] => 4
[planname4] => Premium
[planperiod4] => 3 Months
[plancredit4] => 25
[price4] => 50
[gateway] => paypal
[option] => com_joomjob
[task] => guest.grabplaninfo
[2d13d7c9e4ffff248cf29092b199f5b2] => 1 )
Now what I want to know is that where is this session stored i.e. where can I find the file where these items are processed in the session.
Secondly, if I want to override a value for e.g. change the value of "gateway" from "paypal" to "moneybookers", how can I achieve that? I tried the following code but no luck:
$string="('planChosen', 0, 'register')[\"gateway\"]";
$session->set($string, "moneybookers");
Please help me out with this
I got this from Joomla.org website
The following code gets the current session then sets the value of the session variable 'myvar' to 'helloworld'.
$session =& JFactory::getSession();
$session->set( 'myvar', 'helloworld' );
The session variable can be retrieved later in a similar way.
$session =& JFactory::getSession();
echo 'Session variable myvar has value: ' . $session->get( 'myvar', 'empty' );
So if you used this code to set paypal as payment gateway
$session->set( 'gateway', 'paypal' );
Now if you want moneybookers you can override paypal by
$session->clear('gateway');
$session->set( 'gateway', 'moneybookers' );
And your session data are saved in database by default unless you changed it to files in the global configuration area. So #__sessions has all your session data.
EDIT:
In that case you can do like this
$session =& JFactory::getSession();
$session->set( 'planChosen', $planChosen );//store array in session variable
//Now you have entire array in this session variable which contains paypal as payment gateway
// Suppose you want to update it then use the code below
$session =& JFactory::getSession();
$planChosen = $session->get( 'planChosen' );
unset($planChosen[$gateway]);
$planChosen["gateway"] = "moneybookers";
$session->set('planChosen',$planChosen);

How to create wiki-family on MediaWiki-Vagrant?

Are there any roles to manage or create multiple wikis? I have checked Manual:Wiki family and understand the normal way of creating multiple wiki in a MediaWiki.
I'd like to share what I got in addition to the manual.
Beside of multiple domains/subdomain you can get also multiple path for multiple wikis. Each will stand with different configuration setup by adding the action path at the end line on each of your setting files as shown:
# End of automatically generated settings.
# Add more configuration options below.
$wgArticlePath = "/map/$1";
$actions = array( 'edit', 'watch', 'unwatch', 'delete','revert', 'rollback',
'protect', 'unprotect', 'markpatrolled', 'render', 'submit', 'history',
'purge', 'info' );
foreach ( $actions as $action ) {
$wgActionPaths[$action] = "$wgArticlePath/$action";
}
$wgActionPaths['view'] = "$wgArticlePath";
Change the map variable to your path on each of the setting files then place them under the folders named exactly follow to your path.
So you can modify the code in the LocalSettings.php similar as below:
<?php
// Include common settings to all wikis before this line (eg. database configuration)
$paths = explode('/' , $_SERVER['REQUEST_URI']);
if($paths[2] === NULL) {$path = 'map';} else {$path = $paths[1];}
switch ( $_SERVER['SERVER_NAME'] ) {
case 'wiki.tophyips.info':
require_once "settings/$path/tophyips.php";
break;
case 'wiki.hyipscript.info':
require_once "settings/$path/hyipscript.php";
break;
case 'wiki.hyipmonitors.info':
require_once "settings/$path/hyipmonitors.php";
break;
default:
header( 'HTTP/1.1 404 Not Found' );
echo 'This wiki is not available. Check configuration.';
exit( 0 );
}
Change the map variable on $path = 'map'; to one of your default path of your choice from all the paths you put on the setting files above.
You may check the result of the configuration above on my wiki family page.
The mediawiki::wiki module is used for creating wikis. Some roles that use it are commons and private (there are surely more). If you just want to create a wiki without any extra configuration, you can just write mediawiki::wiki{<wikiname>:} and put it in puppet/modules/role/manifests/my_role.pp (inside a role block - see other role files for the format) and then you can enable/disable via vagrant roles.

Magento translations in external script

I want to be able to use $this->__('String to translate') in an external script. How do I do this? Magento version 1.5.1.0.
I think the right way to set locale is:
Mage::getSingleton('core/translate')->setLocale('sv_SE')->init('frontend', true);
This should work:
require 'app/Mage.php'; // here you should use the correct path to Mage.php file
Mage::app();
Mage::getSingleton('core/translate')->init('sv_SE', true); // UPDATE
$to_translate = "String to translate";
$translated = Mage::helper('core')->__($to_translate);

Does anyone know what is the 32 character string before the product image filename in Magento?

I ask this question, since I am trying to get the images I have just copied from Domain A to work in Domain B, (which is using the same database).
http://DOMAIN_A/magento/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/b/0/b0041-1.jpg
I think knowing what the 32 character string is, which help me find a good explanation why the images are not being found in the front or backend of Magento after reinstall on DOMAIN B.
RE: Magento version 1.4.0.1
Here's the code that creates that filename path, found in Mage_Catalog_Model_Product_Image:
// build new filename (most important params)
$path = array(
Mage::getSingleton('catalog/product_media_config')->getBaseMediaPath(),
'cache',
Mage::app()->getStore()->getId(),
$path[] = $this->getDestinationSubdir()
);
if((!empty($this->_width)) || (!empty($this->_height)))
$path[] = "{$this->_width}x{$this->_height}";
// add misk params as a hash
$miscParams = array(
($this->_keepAspectRatio ? '' : 'non') . 'proportional',
($this->_keepFrame ? '' : 'no') . 'frame',
($this->_keepTransparency ? '' : 'no') . 'transparency',
($this->_constrainOnly ? 'do' : 'not') . 'constrainonly',
$this->_rgbToString($this->_backgroundColor),
'angle' . $this->_angle,
'quality' . $this->_quality
);
// if has watermark add watermark params to hash
if ($this->getWatermarkFile()) {
$miscParams[] = $this->getWatermarkFile();
$miscParams[] = $this->getWatermarkImageOpacity();
$miscParams[] = $this->getWatermarkPosition();
$miscParams[] = $this->getWatermarkWidth();
$miscParams[] = $this->getWatermarkHeigth();
}
$path[] = md5(implode('_', $miscParams));
// append prepared filename
$this->_newFile = implode('/', $path) . $file; // the $file contains heading slash
So, the hash is generated from the configuration info (aspect ratio, etc), as well as the watermark info. This information will not usually change. However, I do see that the path is partially generated from the store_id of the current store, so your trouble may be there.
Is there a reason you can't let Magento use its normal caching procedures for both stores? Since Magento checks the filesystem for the cached image, there shouldn't be a conflict.
Hope that helps!
Thanks,
Joe
Upon contemplation, are you just trying to get the catalog images to work in both domains? The non-cached version of the catalog images are at %magento%/media/catalog/product. Copy the directories from that location and your catalog images should work.
Moving over the cached images isn't going to go far, since they will be deleted next time you flush the Magento cache. So, having moved the images that are in /media/catalog/product, flush the Magento image cache. Make sure that the file permissions are correct for reading. Then, head into Mage_Catalog_Model_Product_Image and take a look at the following code (approx line 270):
if ($file) {
// add these for debugging
Mage::log($baseDir.$file);
Mage::log(file_exists($baseDir.$file));
Mage::log($this->checkMemory($baseDir.$file));
if ((!file_exists($baseDir . $file)) || !$this->_checkMemory($baseDir . $file)) {
$file = null;
}
}
Add a var_dump or Mage::log statement in there (depending on whether you have logging enabled), and verify that the path to the images is correct, and that you have enough memory for the operation. This is the code that will choose the default image for you if no image path exists. If you still can't get it, post the output of those three logging statements and we'll keep trying. :)

Resources