Author Topic: problem  (Read 22521 times)

0 Members and 1 Guest are viewing this topic.

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« on: October 17, 2002, 09:47:49 PM »
Hi,

I want to included a php script in my template file.

name.html
in the html file i have add this row: <?php include("doel.php"); ?>

But if the script want to run ii get this error:

Parse error: parse error in /home/zippie/HTML/includes/template.php(130) : eval()'d code on line 152

What can i do to fix it?

Plz help me. Btw.. i use 1.6

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Another way to php include
« Reply #1 on: October 17, 2002, 10:15:40 PM »
Try putting your php include in your template like this:
Code: [Select]
<?php
include&#40;"doel.php"&#41;;
?>

This usually works.

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« Reply #2 on: October 17, 2002, 10:22:45 PM »
<?php include("doel.php"); ?>

that makes no differents with this.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Try it
« Reply #3 on: October 17, 2002, 11:00:06 PM »
Yes it DOES.  Just try it.  

For PHP syntax, it makes no difference.  For 4images template parsing sometimes it makes all the difference.   :wink:

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« Reply #4 on: October 18, 2002, 08:55:58 AM »
not by me :(


i have try it, but still geting the same error.
What can i do?

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Try full path
« Reply #5 on: October 18, 2002, 02:49:45 PM »
Have you tried using the full path and file name for the include?

Code: [Select]
<?php
include&#40;"/home/zippie/HTML/<whatever else goes here>/doel.php"&#41;;
?>

If that doesn't work, then I don't know what the problem could be.

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« Reply #6 on: October 18, 2002, 03:38:41 PM »
sorry dón't work :(

Code: [Select]

Parse error: parse error in /home/zippie/HTML/includes/template.php(130) : eval()'d code on line 155


line 155 is:       $line = preg_replace('/[\?|%]>/', '', $line);

i think that his mean that there is something in the code, with this caracters, the page won't open. I had delete this, but then i get somemore errors. Maby do you know how to fix it? I use still 1.6 hope that Jan can help me???
This is a very big problem :(

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
problem
« Reply #7 on: October 18, 2002, 04:26:34 PM »
The php parsing of the templates is not made for including some code who must be executed. You should better try to include the files into a script file and register the output into a template variable.

Try this in "includes/page_header.php":

Code: [Select]
ob_start();
@ob_implicit_flush(0);
require("doel.php");
$contents = ob_get_contents();
ob_end_clean();
$site_template->register_vars("doel", $contents);


Use {doel} in your templates.

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« Reply #8 on: October 18, 2002, 04:52:03 PM »
Thanks for the tip,

But you sure that it must be placed in the page_header.php ?

If i do that and i relad the page, my hole page is white. With no content only a blank page.

In index.php i have this at the bottem:

Code: [Select]
require '/home/zippie/HTML/sympoll/booth.php';
ob_start();
@ob_implicit_flush(0);
newest_booth();
$contents = ob_get_contents();
ob_end_clean();
$site_template->register_vars("newest_booth", $contents);
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');

This is for al poll, maby that's why i doesn't work? Hope you can help me. If this is fixed all the problems by all the users are fixed with inludes function etc.


Thanks in advance,

jim
« Last Edit: September 12, 2005, 10:27:57 AM by XippiX »

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
problem
« Reply #9 on: October 18, 2002, 06:07:32 PM »
Can you post a link where you get the script?

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« Reply #10 on: October 18, 2002, 06:16:26 PM »
it's made by myself.

It works fine, only not in the templates.

If i do it with no template, then it works fine. But if i paste it into the layout it don't work.

This is the same for other (php) scripts.

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
problem
« Reply #11 on: October 18, 2002, 06:23:36 PM »
Then try to save the outout in a variable and register it.

For example:
Code: [Select]
require '/home/zippie/HTML/sympoll/booth.php';
$contents = the_function_to return_the output();
$site_template->register_vars("newest_booth", $contents);

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« Reply #12 on: October 18, 2002, 06:33:10 PM »
hi jan , thanks for your fast reply

what you mean with this?

the_function_to return_the output??

sympoll that was my poll, that works fine but the error i get with

this:
<?php include("doel.php"); ?>

You said try this:

Try this in "includes/page_header.php":

Code: [Select]
ob_start();
@ob_implicit_flush(0);
require("doel.php");
$contents = ob_get_contents();
ob_end_clean();
$site_template->register_vars("doel", $contents); 

But how can i fix this?

in page_header i get a blank page if i put the code in it.
Soem months i had problems with my poll...

You said add this in your index.php
Code: [Select]
require '/home/zippie/HTML/sympoll/booth.php';
ob_start();
@ob_implicit_flush(0);
newest_booth();
$contents = ob_get_contents();
ob_end_clean();
$site_template->register_vars("newest_booth", $contents);
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
Works FINE!

But the other problem with the "doel.php"inlcude how can i fix that?

Thanks in advance

jim
« Last Edit: September 12, 2005, 10:28:17 AM by XippiX »

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
problem
« Reply #13 on: October 18, 2002, 07:28:20 PM »
Did you tried to add the code for doel.php in index.php?

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Jaap12

  • Full Member
  • ***
  • Posts: 108
    • View Profile
problem
« Reply #14 on: October 18, 2002, 07:34:50 PM »
no, witch code you mean? the hole code of doel.php paste into index.php?

So if i do that i think it makes no sence for my template layout.

or do you mean this code?
Code: [Select]

require '/home/zippie/HTML/sympoll/booth.php';
$contents = the_function_to return_the output();
$site_template->register_vars("newest_booth", $contents);


And what do you mean with , the function to return the output?