Welcome Guest, Not a member yet? Register   Sign In
Incorporating old application classes/definitions/functions into new codeigniter implementation
#1

[eluser]dmwilson86[/eluser]
Hello, thanks for reading the post. I have been working for a couple weeks porting over a fairly large application into a codeigniter implementation for a product upgrade. I've quickly grown to love codeigniter and all the ways it makes life easier. However, to me, the use of external files in a controller or a view is not well explained. Let me explain...

I've learned how to and successfully implemented a few of my own library classes. Using a definitions file with App-wide definitions stated in the constructor, it is automatically loaded via autoload.php....However, in some of the old code (and some of the new code that I'm writing) I have some javascript that I want parsed by php before it is sent to the client. When I try to include this file using the normal script tag, the php is not parsed (the file is named data.js.php, btw). Trying other options, php include (or require) won't work because of codeigniter folder/file accessibility and security. I realize that I could just load this file as a view, but then I would also have to create separate views for the code above, and below it, right? I have not explored the template option as of yet....to be honest, it might be easier to learn and implement than I think but I'm cautious in favor of keeping things simple, readable, and organized.

I'm sure there is a common solution to this, but I have looked and looked with no luck. I would really appreciate any advice.

One other quick (and related) question that I have is: When you create a library class...can you "<?php include() // or require()?>" anything in that directory, since it is in the same ("library") directory? I'm asking this because some of the files I have are dependent on one another.

Well thanks againfor any help!
#2

[eluser]n0xie[/eluser]
What you could do is make one generic javascript controller which serves your PHP parsed javascript.
#3

[eluser]dmwilson86[/eluser]
Wow, I hadn't thought of that! Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB