Include in plugin

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
brady

Include in plugin

Post by brady »

I am tryong to write a simple plugin.However I am running into problems.I need to include files with include() but whenever I do this nothing happens.  My template from the point of the tag on does not display nor anything in the included file.But I don't get an error message.  Can anyone tell me what is going on?
I know that is a little confusing so here is an example

My plugin

Code: Select all

<?php
function smarty_cms_function_test($params, &$smarty) {
include("test.php");
}

function smarty_cms_help_function_test() {
	?>
	<h3>What does this do?</h3>
	<p>Include a file</p>
	<h3>How do I use it?</h3>
	<p>This is just a basic tag plugin.  You would insert it into your template or page like so: <code>{test}</code>
	<h3>What parameters does it take?</h3>
	<?php
}

function smarty_cms_about_function_test() {
	?>
	<p>Author: Brady</p>
	<p>Version: 1.0</p>
	
	<?php
}

?>
test.php

Code: Select all

<?php
echo "I can't see this";
?>
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Include in plugin

Post by calguy1000 »

It all depends on what your current working directory is, as to wether you can include a relative filename, try putting an absolute path in there.  then it should find it.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am
Location: Deatsville, AL

Re: Include in plugin

Post by Elijah Lofgren »

This may help:

Code: Select all

include (dirname(__FILE__).'/test.php');
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Post Reply

Return to “Developers Discussion”