How can I put html between random images/latest images etc. How can I put html between random images/latest images etc.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

How can I put html between random images/latest images etc.

Started by Cid, August 14, 2009, 05:50:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cid

Since days I try to find out how can i put html code in the code. I try this:


<?php    // This is at the top of your page
  
include_once "./cpg/cpmfetch/cpmfetch.php";  // Line 1
  
$objCpm = new cpm("./cpg/cpmfetch/cpmfetch_config.php"); // Line 2

<div class="title">Latest Uploads</div>

// Here is a spot that you want to have the newest image.
  
$options = array(?subtitle? => ?{{pFilename}}?); // Line 3
  
$objCpm->cpm_viewLastAddedMedia(11$options);  // Line 4

<div class="title">Random Images</div>

// Here is a spot you want the 8 random images with no subtitle from category 1
  
$objCpm->cpm_viewRandomMediaFrom(?cat=1?, 24);  // Line 5

// HTML code and stuff

// Here is the bottom of the page, lets close things up
  
$objCpm->cpm_close();  // Line 6
?>



But this doesn't work for me. So maybe someone can help me. I used the search and the doc from vuud but I have no idea how can this work.  

onthepike

Try uncommenting the line(s) of html. Remove the "//" before "HTML code and stuff".

Cid

this doesn't work, i tried this before...there is this error Parse error: parse error in D:\xampplite\htdocs\new\index.php on line 13...and line 13 is: "Here is a spot that you want to have the newest image."


Cid

okay I've got it:

<div class="title">Latest Uploads</div>
<div class="content-bg">   

<?php
echo "<left>";
  include_once "./cpg/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./cpg/cpmfetch/cpmfetch_config.php");
  $options = array('windowtarget' => '_blank','imagewidth' => '85',"imageheight"=>"85");
  $objCpm->cpm_viewLastAddedMedia(1,4,$options);
$objCpm->cpm_close(); ?>
</div><div class="main-bottom"></div>
<div class="title">Latest uploads</div>
<div class="content-bg">
<?php
echo "<center>";
include_once "./cpg/cpmfetch/cpmfetch.php";
  $objCpm2 = new cpm("./cpg/cpmfetch/cpmfetch_config.php"); 
  $options = array('windowtarget' => '_blank','imagewidth' => '400',"imageheight"=>"450");
$objCpm2->cpm_viewRandomMediaFrom("album=1",1,1,$options);
$objCpm2->cpm_close(); ?>
</div>

Cid

okay I've got it:

<div class="title">Latest Uploads</div>
<div class="content-bg">

<?php
echo "<left>";
  include_once 
"./cpg/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm("./cpg/cpmfetch/cpmfetch_config.php");
  
$options = array('windowtarget' => '_blank','imagewidth' => '85',"imageheight"=>"85");
  
$objCpm->cpm_viewLastAddedMedia(1,4,$options);
$objCpm->cpm_close(); ?>

</div><div class="main-bottom"></div>
<div class="title">Latest uploads</div>
<div class="content-bg">
<?php
echo "<center>";
include_once 
"./cpg/cpmfetch/cpmfetch.php";
  
$objCpm2 = new cpm("./cpg/cpmfetch/cpmfetch_config.php");  
  
$options = array('windowtarget' => '_blank','imagewidth' => '400',"imageheight"=>"450");
 
$objCpm2->cpm_viewRandomMediaFrom("album=1",1,1,$options); 
$objCpm2->cpm_close(); ?>

</div>

Joachim Müller

Quote from: onthepike on August 14, 2009, 07:10:57 PM
Remove the "//" before "HTML code and stuff".
That won't do anything that makes sense.

There is a start tag for PHP and an end tag. The start tag is<?php
The end tag is?>So if you're trying to mix HTML and PHP, you have to instruct the server where the PHP code starts and ends. Within PHP, lines starting with double slashes are comments that don't get parsed (i.e. they are not being taken into account).
As an alternative, you can instruct PHP to output HTML to the browser.
That's why <div style="font-weight:bold">
<?php
  
echo 'Hello world';
?>

</div>
will do the same as<div style="font-weight:bold">Hello world</div>

However, it's beyond the scope of this browser to teach you PHP basics. There are many cool sites on the internet that will gladly do that and teach you those basics.

Quote from: Cid on August 16, 2009, 10:54:15 AM
okay I've got it:
Thanks for resolving your thread.