Welcome Guest, Not a member yet? Register   Sign In
[Fixed] Smarty + CodeIgniter = extra text
#1

(This post was last modified: 01-12-2015, 03:40 PM by WibbenZ.)

[Image: Akma0PWhC.png]

Hey hope someone here can help me with this issue.

As you can see on the image above, I have taken 3 screens.
First one is without Smarty, second one is without CodeIgniter and the third is with both on.
As you might have noticed the text "Welcome" (the index.php view) is displayd above the head code aswell as in the "content" part of the website.

What I need to know is how I can remove the first "Welcome" above the menu. Since I use a smarty command to assign the text from ob_get_contents() and then use that command in my layout.php file.
Note that I only use one layout.tpl, not 3 (header, content, footer).
Regards
Reply
#2

Are you using a Smarty library which was designed to work with CodeIgniter, or just trying to get them to work together yourself? Generally, the output of a template library is going to have be passed to CI's Output class or the library will need to use a display_override hook to bypass CI's output.
Reply
#3

Could you explain abit more? I used a basic Smarty library from github I think I downloaded it from.
I know that there are other systems out there running CodeIgniter & Smarty.
I know that there is something in CodeIgniter or Smarty that I have to change, but since the text I wanna remove is loaded before the template file is even loaded my guess is on CodeIgniter (ref. picture).
Reply
#4

Really bad that they have to approve the messages...
So can't edit a post thats not out yet (if an admin sees this, please edit my post).

Ive been trying to google abit and ive found lots of injections and scripts for it, but none of them work.
You got any links to one that you know works?
Reply
#5

Since I don't use it myself, I have no idea which libraries might actually work. I'm guessing that the most important things to look for will be:
1) make sure the version of CodeIgniter you're using is at least close to the version supported by the library (i.e. CodeIgniter v2.x vs. CodeIgniter v3.x).
2) check to see whether it has been recently updated or other people have mentioned a lot of problems getting it to work.
Reply
#6

Getting really tierd of the "approve message thingi".. Is there some other codeigniter forum that has good members with knowledge?
Ive found a couple, and tried them none has worked as of now, just tried one before I updated the page.

The thing is, that I suspect the only thing that is needed to do is to disable the codeigniter's "auto-loading-template" function, since I handle that from Smarty now insted.
Someone must know where that function is, what more could be needed to change?
Reply
#7

(This post was last modified: 01-07-2015, 04:15 PM by Jamie.)

(01-07-2015, 03:31 PM)WibbenZ Wrote: Getting really tierd of the "approve message thingi".. Is there some other codeigniter forum that has good members with knowledge?
Ive found a couple, and tried them none has worked as of now, just tried one before I updated the page.

The thing is, that I suspect the only thing that is needed to do is to disable the codeigniter's "auto-loading-template" function, since I handle that from Smarty now insted.
Someone must know where that function is, what more could be needed to change?

To be fair the information you've provided is pretty vague, we can see you're using Smarty and CI, however without knowing what Smarty library you're using it makes giving an answer much more difficult.

If any changes are needed to the CI setup this should be in the installation documentation for the library providing the developer has documented it correctly.

If you could help identify which library you are using we will be able to assist further Smile

The approve messages feature is in place to deter spammers, after a few approved posts you will be free to post normally.

You should also note that CI doesn't use a template class since using pure PHP in your view pages lets them run a little faster. Therefore there is no "auto-loading-template" function to disable Smile
Jamie Bond
Full time International Development undergraduate.
Part time website developer.
Reply
#8

(01-07-2015, 09:30 AM)mwhitney Wrote: Are you using a Smarty library which was designed to work with CodeIgniter, or just trying to get them to work together yourself? Generally, the output of a template library is going to have be passed to CI's Output class or the library will need to use a display_override hook to bypass CI's output.

(01-07-2015, 04:07 PM)Jamie Wrote:
(01-07-2015, 03:31 PM)WibbenZ Wrote: Getting really tierd of the "approve message thingi".. Is there some other codeigniter forum that has good members with knowledge?
Ive found a couple, and tried them none has worked as of now, just tried one before I updated the page.

The thing is, that I suspect the only thing that is needed to do is to disable the codeigniter's "auto-loading-template" function, since I handle that from Smarty now insted.
Someone must know where that function is, what more could be needed to change?

To be fair the information you've provided is pretty vague, we can see you're using Smarty and CI, however without knowing what Smarty library you're using it makes giving an answer much more difficult.

If any changes are needed to the CI setup this should be in the installation documentation for the library providing the developer has documented it correctly.

If you could help identify which library you are using we will be able to assist further Smile

The approve messages feature is in place to deter spammers, after a few approved posts you will be free to post normally.

You should also note that CI doesn't use a template class since using pure PHP in your view pages lets them run a little faster. Therefore there is no "auto-loading-template" function to disable Smile

Thanks for the awnser, finally feels like someone has some knowledge about this haha.. Shy
Its the latest one from github - https://github.com/smarty-php/smarty.

About the information, well I really don't know how to explain it any more then I have, when I use CI + Smarty = the code from the view page is shown twice, once above the head code in my template file and in the "content" part of the webiste, as the image shows.
When I tried to remove Smarty I still got the content from my home.php file, that is what I ment by template (just realized it haha) - I want Smarty to handle pretty much everything - or atleast let Smarty assign a variable that I can use in my layout.

So simply updated, I need to remove the ability for CI to show the content from my home.php view file and let the Smarty variable store it till I wanna load the "content" part of the layout.
:p
Reply
#9

Does no one have an awnser on this?
Been trying to find a function that loads the content but can't find it.
Someone must have knowledge of the CI codes :/
Reply
#10

Follow this steps and you will use Smarty with CI.

http://www.coolphptools.com/codeigniter-smarty

Reply




Theme © iAndrew 2016 - Forum software by © MyBB