Solved

Expression Engine Include Class and methods

Posted on 2015-02-04
3
84 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL - Adding an incremented value to a duplicate string 30 53
How do I allow for non standard CSV file 9 47
Code planning methods/tools? 5 56
Google Recaptcha 13 56
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

752 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