php - Code Igniter Custom Helper -


I am new to Code Igniter / OOP but am trying to find out.

I am trying to make an assistant that I can use in my code; (Function_exists ('email')) {function email ($ type, $ to $ theme, $ object) {switch ($ type)} {/} case 'new': $ body = "hello" $ item [first name ']' '. $ Item ['last name'] ",". " & gt; Thank you."; break; } // Send it $ $ -> Load-> Library ('email'); $ This- & gt; Email-> For (for $); $ This- & gt; Email-> From ('blah@website.com ',' James'); $ This- & gt; Email-> Subject ($ theme); $ This- & gt; Email-> Message ($ body); $ This- & gt; Email-> Send (); }}

Then I include it in the autoload for the Helper section.

When I try to access it within my controller, I get an error. $ obect ['first name'] = 'Carl'; $ Obect ['Last Name'] = 'Blow'; Email ('new', 'test@website.com', 'test', $ object);

Here's the error that I'm getting:

  Fatal error: When using $ in the object in C: not in reference: \ inetpub \ wwwroot \  Strong> $ this  when the item is not in context   

This means that you use the $ this keyword outside an object Can not say @ crayton.

Accessories are usually used only to embed in HTML, such as formatting data.

  & lt; P & gt; & Lt ;? Php echo formatHelper (escape ($ in)); ? & Gt; & Lt; / P & gt;   

What you have to do is read a bit about how to make it.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -