Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Expression Engine Include Class and methods

Posted on 2015-02-04
3
Medium Priority
?
116 Views
Last Modified: 2015-02-20
I have a website built on Expression Engine.  I am having a hard time understanding how to include a PHP Class and it's functions.  I have a file that has the Class.  I tried using {embed=?php_classes/quote"} in the template but that does not work.  When I place the actual php Class code above the header it works fine.  Is there a special Include_Once EE syntax?
0
Comment
Question by:rgranlund
  • 2
3 Comments
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 40591619
You can use the regular include_once PHP function - you just have to set the PHP to be parsed on output. The documentation page:

https://ellislab.com/expressionengine/user-guide/templates/php.html

Output: PHP parsed at the “output” stage happens later in the template parsing order, which means it will be parsed after the ExpressionEngine Tags are interpreted. This will allow you to use PHP to affect the “rendered Template”.
0
 
LVL 7

Author Comment

by:rgranlund
ID: 40591753
How do I write that?

{include_once = "php_classes/quote"}
0
 
LVL 35

Accepted Solution

by:
gr8gonzo earned 2000 total points
ID: 40591793
It's just regular PHP - no special EE syntax:

<?php
include_once("php_classes/quote");

Open in new window

...or whatever your filename is.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question