Jump to content

[SOLVED] I want beable to use php and HTML Together..


Gayner

Recommended Posts

like on my forum system..

 

<?php

class skin_ucp {

 

that's inside a .php file and if i write like anything underneath class skin_ucp {

 

i will get

 

Parse error: parse error, expecting `T_FUNCTION' in

 

 

 

but I saw in punbb forum system u can do this:

	generate_admin_menu('groups');

?>
<div class="blockform">

u can use any letters right after a php tag.. lol

 

 

How i do this ?

 

Classes have a particular syntax. See here.

 

You can't simply put code wherever you like within a class.

 

Can i change the syntax to allow to put code wherever I like?  2 Cuase that's how punbb forums do it and im using a different system but Im not switching to punbb forums cause i already spent 3YEARS editing.. and now i finally was wondering if i can use php in there..

 

thanks i'll take a look at that link

 

How do I know which syntax is mine ?

 

This is in my index.php

 

class info {function info() {global $sess, $std, $DB, $INFO;$this->vars = &$INFO;}}$INFO = array();

 

That is my class ?

 

I think i am more lost then u are LOL

Can i change the syntax to allow to put code wherever I like?

 

No, classes have a specific purpose and as such need to be written a specific way.

 

You can easily switch in and out of php within a normal file. eg;

 

<?php
  echo "this is php";
?>
this is not
<?php
  echo "this is php";
?>

 

However, as I said, classes are special. Unless your class is specifically made to be a html outputer or something similar you shouldn't be outputting html from within a class anyway.

Can i change the syntax to allow to put code wherever I like?

 

No, classes have a specific purpose and as such need to be written a specific way.

 

You can easily switch in and out of php within a normal file. eg;

 

<?php
  echo "this is php";
?>
this is not
<?php
  echo "this is php";
?>

 

However, as I said, classes are special. Unless your class is specifically made to be a html outputer or something similar you shouldn't be outputting html from within a class anyway.

 

Well my class have like 25 functions of the same function template listed below:

 

<?php

class skin_ucp {
function photo_page_autosize() {
global $ibforums;
return <<<EOF
<tr>
<td class='pformleft'> </td>
<td class='pformright'><strong>{$ibforums->lang['pph_autosize']}</strong><br>({$ibforums->lang['pph_as_desc']})</td>
</tr>
EOF;
}

function photo_page_mansize() {
global $ibforums;
return <<<EOF
EOF;
}

function photo_page_upload($max_filesize) {
global $ibforums;
return <<<EOF
<tr>
<td class='pformleft'>{$ibforums->lang['pph_upload']}</td>
<td class='pformright'><input type='hidden' name='MAX_FILE_SIZE' value='$max_filesize' /><input type='file' name='upload_photo' value='' size='40' class='forminput' onclick="clear_it()"/></td>
</tr>
EOF;
}

 

ETC ETC...

 

I understand what u said but after u looking at my functions could u give a different answer sir please.

 

 

Can i change the syntax to allow to put code wherever I like?

 

No, classes have a specific purpose and as such need to be written a specific way.

 

You can easily switch in and out of php within a normal file. eg;

 

<?php
  echo "this is php";
?>
this is not
<?php
  echo "this is php";
?>

 

However, as I said, classes are special. Unless your class is specifically made to be a html outputer or something similar you shouldn't be outputting html from within a class anyway.

 

Sir that's exactly What want to beable to do!!

 

 

I even try:

 

return 
?> <?php
$options = array('24-7GT Default', 'Light Blue', 'Sunset', 'Beautiful Blue', 'Tan', 'Crazy Gray', 'Toxin');
$this->output .= "<select name='monkskin'>";
for ($i=0;$i<=6;$i++) {
  if ($member['monkskin'] == $i) {
  
    $this->output .= "<option value='$i' selected='selected'>{$options[$i]}</option>";
  } else {
    $this->output .= "<option value='$i'>{$options[$i]}</option>";
  }
}
$this->output .= "</select>";
	?> <?php 
<<<EOF

 

that doesnt work either nothing outputs..i even tryed echo..

Can i change the syntax to allow to put code wherever I like?

 

No, classes have a specific purpose and as such need to be written a specific way.

 

You can easily switch in and out of php within a normal file. eg;

 

<?php
  echo "this is php";
?>
this is not
<?php
  echo "this is php";
?>

 

However, as I said, classes are special. Unless your class is specifically made to be a html outputer or something similar you shouldn't be outputting html from within a class anyway.

 

Sir that's exactly What want to beable to do!!

 

Yeah, well your out of luck. You can't exit in and out of php half way through a class like you can a function. You'll have to use the HEREDOC syntax as is already being used int he classes you posted. Which, by the way look a terrible example of what a class should be.

Can i change the syntax to allow to put code wherever I like?

 

No, classes have a specific purpose and as such need to be written a specific way.

 

You can easily switch in and out of php within a normal file. eg;

 

<?php
  echo "this is php";
?>
this is not
<?php
  echo "this is php";
?>

 

However, as I said, classes are special. Unless your class is specifically made to be a html outputer or something similar you shouldn't be outputting html from within a class anyway.

 

Sir that's exactly What want to beable to do!!

 

Yeah, well your out of luck. You can't exit in and out of php half way through a class like you can a function. You'll have to use the HEREDOC syntax as is already being used int he classes you posted. Which, by the way look a terrible example of what a class should be.

 

This script is from 2001

lol It works fast tho so i guess ims crewed.. w/e

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.