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: Make a custom CPG page  (Read 10627 times)

0 Members and 1 Guest are viewing this topic.

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« on: October 16, 2003, 02:24:26 pm »

How can I create a custom page in CPG with the header and footer of CPG?

Rodinou

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • Tournicoti, Tournicota
    • http://www.sortons.net
Make a custom CPG page
« Reply #1 on: October 16, 2003, 02:48:16 pm »

Don't understand really :)

Put some content of CPG in other page (so ... your site mainpage or other section) ?

or

Change the layout of CPG ?

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« Reply #2 on: October 16, 2003, 02:53:24 pm »

No, I want to make a custom page, within CPG:
I have already some code:

Code: [Select]
<?php 
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.2.0                                            //
// ------------------------------------------------------------------------- //
// Copyright &#40;C&#41; 2002,2003 Gregory DEMAR <gdemar@wanadoo.fr>                 //
// http&#58;//www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// &#40;http&#58;//coppermine.sf.net/team/&#41;                                          //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// &#40;at your option&#41; any later version.                                       //
// ------------------------------------------------------------------------- // 

define&#40;'IN_COPPERMINE', true&#41;;

require&#40;'include/init.inc.php'&#41;;

pageheader&#40;'laurens'&#41;;
starttable&#40;"100%", $lang_ecard_php['title'&#93;, 3&#41;;

echo <<<EOT
        <tr>
                <td class="tableh1"><h2>Nieuws</h2></td>
        </tr>
        <tr>
                <td class="tableh2"><b>Test1</b>
                </td>
        </tr>
        <tr>
                <td class="tableb" valign="top">
                Test2        <br />
                </td>
        </tr>

EOT;


endtable&#40;&#41;;
pagefooter&#40;&#41;;
ob_end_flush&#40;&#41;;

?>

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« Reply #3 on: October 16, 2003, 03:12:00 pm »

I have now a nice custom CPG HTML page, but I want to include PHP...
How to do it?

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Make a custom CPG page
« Reply #4 on: October 16, 2003, 07:17:27 pm »

I don't get the question. What do you mean it's supposed to do? Isn't echo already a php command? How much more PHP does it have to be?
Maybe something like this
Code: [Select]


// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.2.0                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002,2003 Gregory DEMAR <gdemar@wanadoo.fr>                 //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// (http://coppermine.sf.net/team/)                                          //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //

define('IN_COPPERMINE', true);

require('include/init.inc.php');

pageheader('laurens');
starttable("100%", $lang_ecard_php['title'], 3);

function myfunction()
{
print "How much PHP do you need?";

}

myfunction();

endtable();
pagefooter();
ob_end_flush();

:lol: GauGau
Logged

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Make a custom CPG page
« Reply #5 on: October 16, 2003, 07:34:06 pm »

@ Gaugau - any chance of the PHP bbCode not putting in <?php and ?>

I am usually posting lines which do not have them and dont need them...
Logged
SANIsoft PHP applications for E Biz

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« Reply #6 on: October 16, 2003, 08:07:28 pm »

Thank you for the code!

Edit:
And how can I show only this page if the user who visit this page is an administrator?

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Make a custom CPG page
« Reply #7 on: October 17, 2003, 08:23:27 am »

@lasa: at the top of the file, after the require statement, put in
Code: [Select]
if (!GALLERY_ADMIN_MODE) die('Access denied');. To only show it to an admin, you'll also have to edit your navigation, look for /themes/yourtheme/theme.php and check the admin menu.

@tarique: I'll put this on my todo list

GauGau
Logged

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« Reply #8 on: October 17, 2003, 09:01:56 am »

Thnx!

Edit:
How can I make a link that only shows up in the main menu when te user is an logged-in-admin?

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Make a custom CPG page
« Reply #9 on: October 17, 2003, 10:36:50 am »

you can't, that's what the admin menu is for (well, actually you could, but this'd require some thinking about it, some testing etc. and I just don't see the point in this, so if you can't figure this out for yourself, you're stuck).

GauGau
Logged

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« Reply #10 on: October 17, 2003, 10:41:21 am »

Can I add this code:
Code: [Select]

if (!isset ($preview)) {
  $preview = '0';
}

if (isset ($_POST["submit_add"])) {
  $preview = '0';
  $date_input = @gmdate('YmdHi', time() + (3600 * 2));

  $query = "INSERT INTO weblog VALUES ('','$title_input','$text_input','$date_input','$loggedin_id','$submitted')";
  $exec = mysql_query($query);

  echo '<script>location.href="index.php"</script>';
}

else {
  if (!isset ($title_input) OR !isset ($text_input)) {
    $title_input = "";
    $text_input = "";
  }

  $title_input = ereg_replace( "['\"\]", "", $title_input);
  $text_input = ereg_replace( "['\"\]", "", $text_input);

  include "logo.php";

  echo "<title>Weblog - Add item</title>
  <div id='main'>
  <form method=post action='customcpgpage.php?preview=1'>
  <table cellspacing=0 cellpadding=0 width=100%>
  <tr>
  <td class='header'>
  <b>Add item</b>
  </td>
  </tr>
  <tr>
  <td class='weblog'>
  <table>
  <tr>
  <td class='form'>
  title:
  </td>
  <td class='form'>
  <input name=title_input type=text value='$title_input' size=30 maxlength=25>
  </td>
  </tr>
  <tr>
  <td class='form'>
  text:
  </td>
  <td class='form'>
  <textarea name=text_input>$text_input</textarea>
  </td>
  </tr>
  </table>
  <input name=submit_preview type=submit value=preview>
  </td>
  </tr>
  </table>
  </form>
  ";
}

if ($preview == '1') {
  if ($title_input != "" AND $text_input != "") {
    $preview_date = get_date_long(@gmdate('YmdHi', time() + (3600 * 2)));
    $preview_text = ubb_advanced(ubb_basic(nl2br(htmlspecialchars($text_input))));

    echo "<form method=post action='customcpgpage.php'>
    <table cellspacing=0 cellpadding=0 width=100%>
    <tr>
    <td class='header'>
    <b>$title_input</b>
    </td>
    </tr>
    <tr>
    <td class='weblog'>
    <b>$preview_date</b> posted by <a href=''>$loggedin_name</a>
    <hr>
    $preview_text<br><br>
    <input name=title_input type=hidden value='$title_input'>
    <input name=text_input type=hidden value='$text_input'>
    <input name=submitted type=hidden value='0'>
    <input name=submit_add type=submit value=submit>
    </td>
    </tr>
    </table>
    </form>
    ";
  }

  else {
    echo "<table cellspacing=0 cellpadding=0 width=100%>
    <tr>
    <td class='header'>
    <b>Error</b>
    </td>
    </tr>
    <tr>
    <td class='weblog'>
    Both fields are required.
    </td>
    </tr>
    </table>
    ";
  }
}




Into that function?
Code: [Select]

function myfunction()
{
print "How much PHP do you need?";

}

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Make a custom CPG page
« Reply #11 on: October 17, 2003, 10:46:20 am »

as I said: it's anycontent, you can add anything. I won't look over your code - if you want to learn PHP, start at http://php.net/ and get the manual.

GauGau
Logged

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« Reply #12 on: October 17, 2003, 11:02:47 am »

Okay.
I have a new question... How can I display the name of the logged-in-admin? I want that admin's can post news, but I want to display the author of the news.. Do you get it?

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Make a custom CPG page
« Reply #13 on: October 17, 2003, 11:10:56 am »

No -  we don't get it - we Devs are too dumb to understand all this.
Logged
SANIsoft PHP applications for E Biz

lasa

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 84
    • Fotos.LaSa.nl
Make a custom CPG page
« Reply #14 on: October 17, 2003, 11:13:52 am »

My english is very poor.
So if my queston isn't so clear...

I'm not making your team absurd. You are doing a great job by making coppermine better and better. But i'm not self-assured by asking questions in the english language...

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Make a custom CPG page
« Reply #15 on: October 17, 2003, 11:21:08 am »

OK! granted that your English is poor - English is not my first language either BUT Gaugau, in very simple English,  has gone to great lenghts to explain that what you put in anycontent.php may OR may not be related to CPG and  asking questions about that is waste of resources here...

Let me suggest one thing - go to http://php.net download the manual in whatever language you are comfortable with and read every word of it. At the end there will be light :)
Logged
SANIsoft PHP applications for E Biz

jriba

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 21
Re: Make a custom CPG page
« Reply #16 on: March 18, 2005, 03:03:37 am »

I don't mean to "hijack" this thread, but I think that my question is related to this thread's original purpose.  I have also searched the forum, but have found no answers regarding this.

I have made a couple of "custom" pages for my Coppermine website using the code that GauGau posted here and it works great.

I want to put the "breadcrumbs" in these pages.  For example, one of these custom pages I made is a "Contact Us" page.  Another is a "Legal Terms" page.

I would then like the breadcrumbs, just as they appear everywhere else on the site, to appear on these pages, such as:

"Home > Contact Us"    and    "Home > Legal Terms".

How can I do this?  Which function (if it's that easy) outputs the breadcrumbs?

Thanks for your help!
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Make a custom CPG page
« Reply #17 on: March 18, 2005, 07:17:29 am »

your best bet is just output the table using the same css classes.

from 1.21 html output, I put it in callable function.
Code: [Select]
function my_breadcrumb($href,$title)
{

echo <<<EOT

<table align="center" width="100%" cellspacing="1" cellpadding="0" class="maintable">

        <tr>
                <td class="tableh1"><span class="statlink"><b><a href=index.php>Home</a> > <a href=$href>$title</a></b></span></td>
        </tr>

</table>

EOT;
}
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.