How to echo config item from config file for view in Codeigniter? - codeigniter

How to call config item from config file for view in codeigniter.
here is my config file
$config['user'] = array(
'email_validation' => 'email validation',///^([\w-]+(?:\.[\w-]+)*)#((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
'no_permission' => '/',
'admin_group' => 'admin',
'default_group' => 'default',
'public_group' => 'public',
'users' => 'aauth_users',
'groups' => 'aauth_groups',
'user_to_group' => 'aauth_user_to_group',
'perms' => 'aauth_perms',
'perm_to_group' => 'aauth_perm_to_group',
'perm_to_user' => 'aauth_perm_to_user',
'pms' => 'aauth_pms',
'system_variables' => 'aauth_system_variables',
'user_variables' => 'aauth_user_variables',
'remember' => ' +3 days',
'max' => 13,
'valid_chars' => array(' ', '\''),
'ddos_protection' => true,
'recaptcha_active' => false,
'recaptcha_login_attempts' => 4,
'recaptcha_siteKey' => '',
'recaptcha_secret' => '',
'max_login_attempt' => 10,
'verification' => false,
'email' => 'admin#admin.com',
'name' => 'Emre Akay'
);
Here is my load config
$this->config->load('user');
And I will view its item for view as below
$site_name = $this->config->item('email_validation');
But is don't show any thing

This is because your config array is two dimensional array. So, you can't access directly email_validation without getting user first. Moreover,
$this->config->load('user'); just means loading user.php from application/config/ directory. Doesn't mean loading user index from $config array. You can do it like that.
$userConfig = $this->config->item('user');
echo $userConfig["email_validation"];
Edit
Please make sure you config file is under application/config/ and loaded.
$this->config->load('user');
You can check which config is loaded by doing like this.
echo "<pre>";
print_r($this->config);
echo "</pre>";
Hope it will be useful for you.

if your php version>=5.4 you can use this
$site_name = $this->config->item('user')['email_validation']

Related

Where is the file after create by "$service->spreadsheets->create($requestBody)"

Thank you very much for reading this, its quite long!
I run my function:
public function createSpreadSheet()
{
$client = $this->getClient();
$service = new \Google_Service_Sheets($client);
// TODO: Assign values to desired properties of `requestBody`:
$requestBody = new \Google_Service_Sheets_Spreadsheet();
$response = $service->spreadsheets->create($requestBody);
echo '<pre>', var_export($response, true), '</pre>', "\n";
}
I got a result:
Google_Service_Sheets_Spreadsheet::__set_state(array(
'collection_key' => 'sheets',
'developerMetadataType' => 'Google_Service_Sheets_DeveloperMetadata',
'developerMetadataDataType' => 'array',
'namedRangesType' => 'Google_Service_Sheets_NamedRange',
'namedRangesDataType' => 'array',
'propertiesType' => 'Google_Service_Sheets_SpreadsheetProperties',
'propertiesDataType' => '',
'sheetsType' => 'Google_Service_Sheets_Sheet',
'sheetsDataType' => 'array',
'spreadsheetId' => '1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU',
'spreadsheetUrl' => 'https://docs.google.com/spreadsheets/d/1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU/edit',
'internal_gapi_mappings' =>
array (
),
modelData' =>
array (
),
'processed' =>
array (
),
'properties' =>
Google_Service_Sheets_SpreadsheetProperties::__set_state(array(
'autoRecalc' => 'ON_CHANGE',
'defaultFormatType' => 'Google_Service_Sheets_CellFormat',
'defaultFormatDataType' => '',
'iterativeCalculationSettingsType' => 'Google_Service_Sheets_IterativeCalculationSettings',
'iterativeCalculationSettingsDataType' => '',
'locale' => 'en_US',
'timeZone' => 'Etc/GMT',
'title' => 'Untitled spreadsheet',
'internal_gapi_mappings' =>
array (
),
'modelData' =>
array (
),
'processed' =>
array (
),
'defaultFormat' =>
Google_Service_Sheets_CellFormat::__set_state(array(
'backgroundColorType' => 'Google_Service_Sheets_Color',
'backgroundColorDataType' => '',
'bordersType' => 'Google_Service_Sheets_Borders',
'bordersDataType' => '',
'horizontalAlignment' => NULL,
'hyperlinkDisplayType' => NULL,
'numberFormatType' => 'Google_Service_Sheets_NumberFormat',
'numberFormatDataType' => '',
.........
.........
))
I access to the link it returned:
'https://docs.google.com/spreadsheets/d/1QlBQo_YHQpiiMBWn6b6wSMVWkiFRx4grJhPParXUUSU/edit'
it gives me this 'request access' page, then I press the request access
I open my email and get this:
Your message wasn't delivered to xxxxxx#xxxxxxxx.iam.gserviceaccount.com because the domain admanager-1x3x71x4x27x4.iam.gserviceaccount.com couldn't be found. Check for typos or unnecessary spaces and try again.
Is there something wrong and what should I do? I just want to open the file and check where it is.
Thank you very much!

Laravel: Whole lang files in on view

I want to localize my Laravel app.
I call it on blade like this: #lang('bot.bots')
But my view I got this:
My bot.php is:
<?
return [
'bots' => 'Bot|Bots',
'addBot' => 'Add bot',
'editBot' => 'Edit bot',
'deleteBot' => 'Delete bot',
'compose' => 'Compose',
'addGroup' => 'Add group',
'editGroup' => 'Edit group',
'deleteGroup' => 'Delete group',
'confirmDeleteGroup' => 'Are you sure you want to delete the group?',
'textRecognition' => 'Text recognition',
'newRule' => 'Add rule',
'deleteRule' => 'Delete rule',
'confirmDeleteRule' => 'Are you sure you want to delete the rule?',
'editBot' => 'Bot szerkesztése',
'input' => 'Input',
'output' => 'Output',
'addInput' => 'Add input',
'addOutput' => 'Add output',
'blocks' => 'Block|Blocks',
'groups' => 'Group|Groups',
'text' => 'Text',
'broadcast' => 'Broadcast',
'analytics' => 'Analytics',
'chatPartners' => 'Chat Partners',
];
What can be the problem? I did everything like what's in the documentation
Just indicate the count like this
$bots_count = 4 //replace with count
#lang('bot.bots', $bots_count)
You may also use translation choices, for which your array would look like this
return [
'bots' => '{0} No Bots|{1} Bot|[2,*] Bots',
...
];

How to add elements to a fieldset in magento horizontally rather than vertically

I am adding few check boxes in to magento using the fieldset option like the following.
$fieldset = $form->addFieldset('display', array(
'legend' => $helper->__('Schedule Sales Order Transfer'),
'class' => 'fieldset-wide'
));
for($i=01; $i*5<60; $i++){
$time = $i*5;
$fieldset->addField('min'.$time, 'checkbox', array(
'name' => 'Checkbox',
'checked' => false,
'onclick' => self::setAll("min"),
'onchange' => "",
'value' => ''.$time,
'disabled' => false,
'after_element_html' => '<small>'.$time.'</small>',
'tabindex' => 1
));
}
By doing so, all the check boxes are coming one below another. Is it possible to make it one adjacent to another i.e., horizontally?
Anybody Please suggest the solution ASAP...
Thank you,
In your Code return like <tr>...</tr><tr>..</tr>, so if you need to add custom css or js to achieve what you expected,
or
for($i=01; $i*5<60; $i++){
$time[$i]['value'] = $i*5;
$time[$i]['label'] = $i*5;
}
$fieldset->addField('Time', 'checkboxes', array(
'label' => $this->__('Time'),
'name' => 'time[]',
'values' => $time,
'value' => '1',
'tabindex' => 1
));
its return like <tr><td>label</td><td>value<ul><li></li>....<li></li></ul></td></tr>
then you continue your stuff.,
Note: I'm just suggest the possible ways

sending form data via PHP

I'm trying to submit a form using PHP and the mailchimp 2.0 api.
I'm getting an error that says:
FNAME must be provided
My form has a field for the first name:
<input type="text" name="fname">
So it must have something to do with the way I am handling it the php side.
Here is the bit of php that handles FNAME:
$result = $MailChimp->call('lists/subscribe', array(
'id' => 'myid',
'email' => array( 'email' => $_POST['email']),
'FNAME' => $_POST['fname'],
'LNAME' => $_POST['lname'],
'double_optin' => false,
'update_existing' => true,
'replace_interests' => false
));
I'm not sure if I'm forming the array correctly or not.
By the way, I'm using this wrapper, but I think my error has to do with how I create $result and not the wrapper.
https://github.com/drewm/mailchimp-api
Any help would be appreciated.
Thanks!
Peep the example at the bottom of the page you linked to. I've pasted it here:
$result = $MailChimp->call('lists/subscribe', array(
'id' => 'b1234346',
'email' => array('email'=>'davy#example.com'),
'merge_vars' => array('FNAME'=>'Davy', 'LNAME'=>'Jones'),
'double_optin' => false,
'update_existing' => true,
'replace_interests' => false,
'send_welcome' => false,
));
print_r($result);
Your merge vars (ex. FNAME and LNAME) need to be in its own array. So, add a 'merge_vars' in your array and create an array that contains your field's merge variables.

ReferenceError: MediabrowserUtility is not defined in magento wysiwyg

my question that i am using wysiwyg editor in magento admin side i checked every page every thing is right no error in code when click on the insert image they generate the error and can not works fine so help me anyone they face this type of error. error is
"ReferenceError: MediabrowserUtility is not defined"
thanks
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => 'form_section'));
$wysiwygConfig["files_browser_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index');
$wysiwygConfig["directives_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
$wysiwygConfig["directives_url_quoted"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
$wysiwygConfig["widget_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/widget/index');
$wysiwygConfig["files_browser_window_width"] = (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width');
$wysiwygConfig["files_browser_window_height"] = (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height');
$plugins = $wysiwygConfig->getData("plugins");
$plugins[0]["options"]["url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_variable/wysiwygPlugin');
$plugins[0]["options"]["onclick"]["subject"] = "MagentovariablePlugin.loadChooser('".Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_variable/wysiwygPlugin')."', '{{html_id}}');";
$plugins = $wysiwygConfig->setData("plugins",$plugins);
$fieldset->addField('question_details', 'editor', array(
'name' => 'content',
'label' => Mage::helper('supportportal')->__('Details'),
'title' => Mage::helper('supportportal')->__('Details'),
'style' => 'width:600px; height:300px;',
'config' => $wysiwygConfig,
'wysiwyg' => true,
'required' => true,
));
The error is due to a missing configuration setting which is assigned to the WYSWIG addField() array.
If you open your Form.php simply add the following above the WYSIWYG field,
$configSettings = array( 'add_widgets' => false, 'add_variables' => false, 'add_images' => false, 'files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/'));
Then modify your WYSIWYG form field (see highlighted below),
$fieldset->addField('post_content', 'editor', array(
'name' => 'post_content',
'label' => Mage::helper('faqs')->__('Answer'),
'title' => Mage::helper('faqs')->__('Answer'),
'style' => 'width:700px; height:500px;',
'wysiwyg' => true,
'config' => $configSettings
));
for detail you can see this link and also read some comments on that
hope this will sure help you

Resources