1
rosytoes
both html and php in Content type
  • 2005/10/9 11:50

  • rosytoes

  • Just popping in

  • Posts: 24

  • Since: 2005/10/9


i am building a block and not sure how I would enter both html and php code into the content box. the php code doesnt seem to work when i choose html as type and i havent been able to make php code work when choosing php as content type. any advice pls

2
Herko
Re: both html and php in Content type
  • 2005/10/9 11:52

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


when you use php as conetnt type, make sure you omit (=leave out) the starting <?php and ending ?> tags.

Herko

3
rosytoes
Re: both html and php in Content type
  • 2005/10/9 12:02

  • rosytoes

  • Just popping in

  • Posts: 24

  • Since: 2005/10/9


thx for quick reply.
i tried putting this in and choose php as content type but nothing is showing up.

include ("view.php")

do I need to use smarty tag for including files?

4
rowdie
Re: both html and php in Content type
  • 2005/10/9 12:30

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


When you choose php as content type, it means you also need to use php syntax

include ("view.php");

should work, when you include the semicolon at the end.

Though I'm not actually certain that "include"s are allowed, why not just put the php code directly in the block?

For your html you could try using 'echo'
... or maybe closing the php tag, writing your html, then opening it again might work... I have never tried it, and don't have access to a php-enabled server at this moment, sorry.

5
JMorris
Re: both html and php in Content type
  • 2005/10/9 12:38

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Quote:
Though I'm not actually certain that "include"s are allowed, why not just put the php code directly in the block?

For your html you could try using 'echo'
... or maybe closing the php tag, writing your html, then opening it again might work... I have never tried it, and don't have access to a php-enabled server at this moment, sorry.


As long as the server has allow_url_fopen enabled, there shouldn't be a problem.

Closing the php tag and writing the html after it won't work; tried it. You'll need to use echo to output HTML. So to answer the original question, to mix HTML and PHP in a block, select the PHP code block content type and type in your code like so...

echo ('<b>This is my included file</b><br />');
include (
"myfile.php");


You may also need to give the url or path for the file you are including, like so...

include ("../../myfile.php");


or

include ("http://mysite.com/myfiles/myfile.php");


Hope this helps.

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

6
rosytoes
Re: both html and php in Content type
  • 2005/10/9 13:28

  • rosytoes

  • Just popping in

  • Posts: 24

  • Since: 2005/10/9


there is some slight progress, the include seems to be working as I am now getting the following error:

MySQL Error : Connection Error
Error Number: 0
Date : Sun, October 9, 2005 14:19:40
IP : 192.168.0.66
Browser : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
Referer :
PHP Version : 4.3.8
OS : WINNT
Server : Microsoft-IIS/5.1
Server Name : 192.168.0.68
Script Name : /index.php

7
rosytoes
Re: both html and php in Content type
  • 2005/10/9 13:43

  • rosytoes

  • Just popping in

  • Posts: 24

  • Since: 2005/10/9


I have managed to get it working, I had to paste the database connect info. into the content box. I have a feeling there must be some better way of doing this...

Login

Who's Online

99 user(s) are online (56 user(s) are browsing Support Forums)


Members: 0


Guests: 99


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits