Hi. I've got a great article running in a php block using cpmfetch and some text. It looks really cool. I have the images in a vertical table and some text talking about the images to the left. I want to turn this block into an interview with featured members, so I'd love it if I could show an introduction, then allow users to click read more just like a regular article. Is there any way to do an intro with php blocks? or is there some way to do this in a regular block? I tried using tags like: <?php my code here ?> in a non php article but I was not successful. I'm still a newbie, but I really appreciate the help!!
You cannot use the <?php tags. Just change your article to a php article and echo (http://www.ichbin.us/index.php?topic=19.0) all your stuff.
You must NOT echo all stuff.
try uses this as example ...
<?php
any php code
?>
html code
<?php
php code
?>
html code
and so one ...
Fel
But the php tags will not apply correct when you add them in a block or article as they are predifined with the code when you create them ???
ahh ... I not have tested that at the moment.
Normaly, it's works ...
Fel
Like in a ssi_php example: <?php ssi_recentTopics(); ?> will not work but like this it will work: ssi_recentTopics(); !
Thanks for the replies. Sorry. I forgot to set notification.
So you can put php into a normal article?
I got errors when I tried with <?php in a regular article.
When I tried "add php" with out <?php everything worked, but I couldn't get an intro.
Here's a sample of what I'm using (remember I'm still a newbie, I'll start using css tags instead of html soon...)
$featureprofile = '<font color="#3300cc" size="4">Featured profile</font><br><font size="3"><a href="/forum/index.php?action=profile;u=1022">Name Here</a></font><br />';
$featured3 = "<br><font size='2'>Intro. Click this <a href='/forum/index.php?topic=4860.0'>link</a> for more info</font><br><br />
<b>Tell us about your art.</b><br>Text here<br>k<br />";
$featureprofile2 = "<br><font size='2'>Another link <a href='/forum/index.php?action=profile;u=1022'>name or images</a> for more information.</font><br />";
echo $featureprofile;
echo '<table><tr>';
echo '<td width="70%" valign="top">';
echo $featured3, $featureprofile2;
echo '</td>';
echo '<td><center>'; include_once "/public_html/gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/public_html/gallery/cpmfetch/cpmfetch_config.php");
$options = array( "cellattributes" => array("align" => "center","height" => "105", "width"=>"110"), "cellStyle" => "align='center'" );
$objCpm->cpm_viewRandomMediaFrom("cat=1,2,3:owner=felixkat", 5, 1, $options);
$objCpm->cpm_close();
echo '</center></td>';
echo '</tr></table>';
I imagine I could just create 2 php articles. One short version with a link to another article with more text and images to get the "into" feel. Can you define variables in one php article, and echo the same variable in another article?
shure ..
you have to use in article 1 (example)
global $context;
$context['myvar'] = 'asyouwant';
in the other article you can use
global $context;
echo $context['myvar'];
Note, that you must load both articles in the same content.
Fel
Hi thanks! I'll give that a try!!
I'm sorry if this is a silly question, but what does it mean to load both articles in the same content?
Both articles must be loaded on the same page to do this.
Thanks IchBin.
I was thinking of having one as an intro on the front page, and the other not on the front page. So this probably won't work. Hell. Maybe I'm just lazy. I can always define the variables for each article Any other thoughts about creating a php intro?
You can always add that code to an invisible block as well. :D
I have the following code working fine in a standard PHP page that uses the <?php ?> tags:
<BR>
<FONT COLOR="#80000">__ Enter Your Name (optional):</font><BR>
<INPUT TYPE=text NAME="name" SIZE=40 MAXLENGTH=60 VALUE="<? echo $name; ?>">
<P>
and have tried to get it to work in a Tiny Portal PHP article by changing it to the following but I cannot figure out how to handle VALUE="<? echo $name; ?>" correctly. What am I doing wrong here?
echo '
<BR>
<FONT COLOR=\"#80000\">__ Enter Your Name (optional):</font><BR>
<INPUT TYPE=text NAME=name SIZE=40 MAXLENGTH=60 VALUE= echo $name;>
<P>';
Quote from: marzi on August 01, 2007, 01:12:35 PM
and have tried to get it to work in a Tiny Portal PHP article by changing it to the following but I cannot figure out how to handle VALUE="<? echo $name; ?>" correctly. What am I doing wrong here?
echo '
<BR>
<FONT COLOR=\"#80000\">__ Enter Your Name (optional):</font><BR>
<INPUT TYPE=text NAME=name SIZE=40 MAXLENGTH=60 VALUE= echo $name;>
<P>';
you have to use follow:
echo '
<BR>
<FONT COLOR="#80000">__ Enter Your Name (optional):</font><BR>
<INPUT TYPE="text" NAME="name" SIZE="40" MAXLENGTH="60" VALUE="'. $name .'">
<P>';
Fel
Danke :)
marzi
I use HTML in a php-article. I just started the article with ?> and entered some html and then just added <?php at the end again.
The reason I did this was to be able to use some php variables in the middle of the html block.
Worked fine for me. Maybe not the best and perfect way, but at least it did what I wanted without to much fuss.