CodeIgniter not loading my lang file - php

I have controller and there is a function which calls password. There I have email form:
$this->email->from('system#domain.us', "domain.us");
$this->email->to($user_data['email']);
$this->email->subject(lang('users_validations_passwordemail_title'));
$this->email->message(lang('users_validations_passwordemail_hi').", ". ucfirst(strtolower($userInfo[0]['username'])) .lang('users_validations_passwordemail_text'). $user_data['random_string'] ."");
$this->email->send();
and in the controller contructor function I have:
$this->lang->load('controllers', $this->session->userdata('session_lang'));
but when I tried to send message I've got this message:
Unable to load the requested language file: language/france/email_lang.php
so how tu use it? why i've got this error? how to fix it?
BTW - I tried to use lang('users_validations_passwordemail_title') simple (not in email form) and that worked for me..

Well, you are loading a file which does not exist. If you have a france language folder, you have to have email_lang.php file in it with your required data. In this case, your required language key

Related

In OctoberCMS how do you find the hint path?

Mail::sendTo($to, 'OctoberCMS.PhotoElegance::mail.contactform', $params);
When this line of code is called I get back an error which says the following:
"No hint path defined for [OctoberCMS.PhotoeElgance] on line 112 of vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php"
In simple, I am trying to send mail when the contact form is submitted. The code is inside a function called onStart(). I discovered that the appname is OctoberCMS. After the dot I have PhotoElegance as that is the website name.
After the hint path (OctoberCMS.PhotoElegance) I am calling the static function (mail.contactform) to my defined contact form which has been built in the CMS.
Where do I find out the appname and website name. How do I define these if I want to change them. I understand this is to do with name spacing but I cannot figure it out.
hi the way you try to send an email is called "Mail view" this is the way you do send mail form a plugin, and the path to the mail view is author.plugin::path.to.view.
From the very short definition of your problem i can tell that you are not using plugin but the dynamic pages feature of october cms so you must use "mail template" .
Go to setting > find mail->mail template in the left side bar > click new template chose a code once done you can use this tempalte to send email from dynamic page.
Mail::sendTo($to, 'template.code', $params);

CakeEmail is erroneously reporting that a template is missing when using themes

I have a controller QuickContacts with an action add() which uses CakeEmail to send a message, like so:
$Email = new CakeEmail();
$Email->from(array('noreply#xyz' => 'xyz'));
$Email->to(($this->isBranded) ? $this->brandedAccount['BrandedAccount']['contact_us_email'] : EMAIL_TO_MAIL_ADDRESS);
$Email->subject(EMAIL_QUICK_CONTACTS_SUBJECT);
$Email->emailFormat('html')->template('add', 'default');
$Email->message($this->request->data);
$Email->send();
When I try and send the mail, I get an error indicating that a view file does not exist:
Missing View
Error: The view for QuickContactsController::add() was not found.
Confirm you have created the file: Emails/html/add.ctp in one of the following paths:
/var/www/html/mysite/app/View/Themed/Xyz/Emails/html/add.ctp
I can certainly confirm those files exist, but for some reason CakePHP still is unable to find them, and I can't figure out why this might be happening. Can anyone point me in the right direction?
You have to explicitly set the theme in CakeEmail:
$Email->theme('xyz')
as described in the Cookboox 2.x: Sending Templated Emails.
The error message is pointing you towards the correct path, but CakePHP is looking for your file in:
/app/Emails/html/add.ctp
This may be due to a bug.

PHP Issue | Class Email Not found, Double Opt in form

So I recently came across this tutorial for creating a double opt in script. But it does not seem to be working.
Can someone check it out and see what's wrong with it?
Every time I try to use it, I get the error
Class 'Email' not found in register.php at line 12
Here is the link to the article: http://tonygaitatzis.tumblr.com/post/66610863603/double-opt-in-email-registration
Here is the github link for the download: https://github.com/backupbrain/double-opt-in-registration-php
In the register.php only emailregistration class is loaded.
But at line 12, you are trying to create instance of class email which is not loaded in this php file.
Load this class before using it in the code
require_once('classes/Email.class.php');

yii2: how to render a view in mail

I am able to send mail using swiftmailer extension. I am also able to include the view file from #app/mail folder.
Now I am wondering how I can include the data for my model views for example say I have a Model City.php and related view as view.php or index.php(grid-view) how can I include the data rendered in view.php(single record) or table data in index.php in mail body.
In short I want to include the default data rendered in yii2 in views or index in mail body.
Hi, I have seen this example like - Yii::$app->mailer->compose('viewName', ['variable' => $variable])
another example - Yii::$app->mailer->compose('contact/html', ['contactForm' => $form])
I have tried like this without much success:
Yii::$app->mailer->compose('medicine-request-entry/html',['medicine_request_entry'=>$form])
but I am getting the error undefined variable form. medicie_request_entry is the folder in views folder.(not in #app/views)
but couldn't get it. Say my view name in /mail/ subfolder is say report.php and I have a folder in my views subfoler /city/ and in city folder there is view.php and index.php how I can specify this in the parameter in the example code.
Any suggestion will be greatly appreciated.
Thanks.
Ok I found the solution and putting the answer for anyone having the same difficulty
I modified the code in my controller like:
Yii::$app->mailer->compose('#app/views/medicine-request-entry/view',['model'=>$model])
But I still didn't get, how to use layout given in #app/mail or to send the mail as html.
Thanks.
\Yii::$app->mailer->htmlLayout = "#app/mail/layouts/html";
$message = Yii::$app->mailer->compose('#app/mail/welcome');
var_dump($message);

How to integrate a new file in a module in SugarCRM 7?

I added a new button in detailviews of a module, having the attribute onClick="genReg(name, type)".
I created this function in a .js file. This function (genReg(name, type)) send the variables to a PHP file, generateReg.php, using JSON.
The file is in *module_name* folder. In this PHP file I try to create a new object of modules Reglement (it's a custom module) and add new item to the database.
The problem is that it doesn't recognize the path to the module Reglement.
I included it as follows:
require_once('modules/Reglement/Reglement.php');
but got the following error:
Error: Failed opening required 'modules/Reglement/Reglement.php'
Paths to my files:
js: custom/module_name/js/generate.js
php: custom/module_name/generateReg.php
Which file shall I include in order to recognize all the path?
Yes, I did that error :D, calling directly. I change the url in js file like this http://localhost.net/index.php?entryPoint=generateReg and it works now. Thank a lot.
But I've got an other error. When I call this url I send POST data. In my file I have the POST data, but the function json_decode($_POST['data']) return nothing.
print_r($_POST['data']) -> return a valid json
json_decode($_POST['data']) return nothing
Do you know if Sugar do something that change the behaviour of json_decode?

Categories