Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: How can I put html between random images/latest images etc.  (Read 5789 times)

0 Members and 1 Guest are viewing this topic.

Cid

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
How can I put html between random images/latest images etc.
« on: August 14, 2009, 05:50:43 pm »

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


Code: [Select]
<?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.  
« Last Edit: August 14, 2009, 08:46:22 pm by François Keller »
Logged

onthepike

  • Guest
Re: How can I put html between random images/latest images etc.
« Reply #1 on: August 14, 2009, 07:10:57 pm »

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

Cid

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: How can I put html between random images/latest images etc.
« Reply #2 on: August 15, 2009, 10:27:01 pm »

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."

Logged

Cid

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: How can I put html between random images/latest images etc.
« Reply #3 on: August 16, 2009, 10:51:14 am »

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>
Logged

Cid

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: How can I put html between random images/latest images etc.
« Reply #4 on: August 16, 2009, 10:54:15 am »

okay I've got it:
Code: [Select]
<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>
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How can I put html between random images/latest images etc.
« Reply #5 on: August 17, 2009, 09:03:30 am »

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
Code: [Select]
<?phpThe end tag is
Code: [Select]
?>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
Code: [Select]
<div style="font-weight:bold">
<?php
  
echo 'Hello world';
?>

</div>
will do the same as
Code: [Select]
<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.

okay I've got it:
Thanks for resolving your thread.
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 19 queries.