4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
February 19, 2018, 08:38:04 AM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support)
| | |-+  Tutorials (Moderators: mawenzi, Rembrandt)
| | | |-+  [TUT] How to add a new, custom PHP page
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Current Topic Rating: *****
Author Topic: [TUT] How to add a new, custom PHP page  (Read 17601 times)
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 896

Vienna


View Profile WWW
« on: January 01, 2011, 11:54:53 AM »

How to add a new, custom PHP page

I've put in all the files important comment texts written.
I think, then everyone knows.

Example:
1.) copy the text below, call it "custom.php" and store it in your galerie root:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
 
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: custom.php                                           *
 *        Copyright: (C) 2002-2009 Jan Sorgalla                           *
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.9                                                *
 *     File Version: 1.0.0 (by Rembrandt www.vienna-pictures.com)         *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 'custom'// <-- Your Template Title

define('GET_CACHES'1);
define('ROOT_PATH''./');
define('MAIN_SCRIPT'__FILE__);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
include(
ROOT_PATH.'includes/page_header.php');
$txt_clickstream $lang['custom_name']; // <-- Clickstream Name

//################## EXAMPLE CUSTOM PHP CODE STARTS HERE ############################


  
if ($user_info['user_level'] == GUEST){
    
$my_php  "You have no Access !<br>";
    
$my_php .= "Please Login:<br>";
    
$my_php .= "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">Login</a>";
  }
    else {
      
$my_php  "<b> Hello &nbsp;".$user_info['user_name']."</b><br>";
      
$my_php .= "as such we register the text below in the 'lang/your language/main.php' &nbsp;<br>".$lang['example_text'];

    }

//Here starts the lang register   
$site_template->register_vars(array( 
  
"content" => $my_php,                                   // <-- It is important that the same name used as in PHP Code above (in this example "my_php")
  
"lang_custom_page_title" => $lang['custom_page_title'], // <-- Page Title
  
"lang_example_text" => $lang['example_text']                 // <-- the "example_text" must still be registered in the "lang/your language/main.php"
));

//################## EXAMPLE CUSTOM PHP CODE END HERE ################################

//----------------------------------------------------- 
//--- Clickstream ------------------------------------- 
//----------------------------------------------------- 
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>"

//----------------------------------------------------- 
//--- Print Out --------------------------------------- 
//----------------------------------------------------- 
$site_template->register_vars(array( 
  
//"content" => $content, 
  
"msg" => $msg
  
"clickstream" => $clickstream
)); 
$site_template->print_template($site_template->parse_template($main_template)); 
include(
ROOT_PATH.'includes/page_footer.php'); 
?>


2.) copy the error.html from your template, and rename it to "custom.html" and store it in your Template folder.
  the code  "{content}" here shall displayed your php code from the "custom.php".
  the code "{lang_custom_page_title}" here shall displayed your page title.
search in the new "custom.html":
1
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
insert above:
1
<a href="custom.php"><b>{custom_name}</b></a>&nbsp;
search:
1
<p>{error_msg}</p>
and replace:
1
{content}
search:
1
{lang_error}
and replace:
1
{lang_custom_page_title}

3.) put the code below where you ever you want in lang/yourlang/main.php (between <?php...?>):
1
2
3
4
5
6
7
 //----------------------------------------------------- 
//------------------ Custom --------------------------- 
//-----------------------------------------------------
$lang['custom_name'] = "My first PHP Template"// Clickstream Name
$lang['custom_page_title'] = "This is your first custom site"// Page Title
$lang['example_text'] = "<br><b>This is a Example Text, registered in the \"lang/your language/main.php\"</b>"// Example Text
 

4.) so you can access your page, add the following link into all other html pages (where ever you want):
1
<a href="custom.php"><b>{custom_name}</b></a>&nbsp;
and the link so you can see, he must be registered in the includes/page.header.php:
 search in includes/page.header.php:
 
1
2
3
 $site_template->register_vars(array(
  
"lang_site_stats" => $lang['site_stats'],
 
insert below:
1
2
 "custom_name" => $lang['custom_name'],
 

 login as user and as guest, you can see the difference in the "custom.html ".
 run your custom page, you can all the comment lines remove from the code.
 
 mfg Andi

« Last Edit: January 02, 2011, 07:04:35 AM by Rembrandt » Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
haider512
Full Member
***
Offline Offline

Posts: 153

Thank You
-Given: 57
-Receive: 2


View Profile
« Reply #1 on: January 01, 2011, 02:19:13 PM »

@ Rembrandt

Many Many Many Many Many Many Many Many Many Many Many Many THanks for this Mod..

Superb..Mate..Many thanks for this mod that you made...


im going to apply it now..

i have question..
will this page will b visible for both guests and users or only users..

Actually i want this page to b visible for both users and and guests..that both can see the page..

so it is possible in this to make the availability of page for both users and guests.??
Logged
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 896

Vienna


View Profile WWW
« Reply #2 on: January 01, 2011, 03:43:49 PM »

.....
so it is possible in this to make the availability of page for both users and guests.??

 Shocked Shocked remove the example code, and put in your php code.
this is only a example code.
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
haider512
Full Member
***
Offline Offline

Posts: 153

Thank You
-Given: 57
-Receive: 2


View Profile
« Reply #3 on: January 02, 2011, 06:40:46 AM »

Its working awesome..

The page is working..with what ever changes i do in .html


but i dont understand one thing..

i mean when i do change in main language file it dont appear there..

1
2
3
$lang['legends_name'] = "Legends";
$lang['support_name'] = "Top Supporters";
$lang['legends_page_title'] = "CUSIT Library Legends";

so the above new language i defined in main.php in my english language..

but it is not appearing when i call in the .html file..

here i used when i call the above language.

{support_name}

i also tried {lang_support_name}

but it didnt worked..

i missed some thing.. please tell me what should i do to use my define language.?

here is the link to my custom page..

http://cusitlibrary.com/legends.php
« Last Edit: January 02, 2011, 06:55:25 AM by haider512 » Logged
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 896

Vienna


View Profile WWW
« Reply #4 on: January 02, 2011, 06:59:27 AM »

in custom.php:
search:
1
2
$site_template->register_vars(array( 
  
"content" => $my_php,
 
insert below:
1
2
3
"lang_legends_name" => $lang['legends_name'],
"lang_support_name" => $lang['support_name'],
"lang_legends_page_title" =>$lang['legends_page_title'],

in main.php:
1
2
3
$lang['legends_name'] = "Legends";
$lang['support_name'] = "Top Supporters";
$lang['legends_page_title'] = "CUSIT Library Legends";

in custom.html:
1
2
3
{lang_legends_name}
{lang_support_name}
{lang_legends_page_title}


Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
haider512
Full Member
***
Offline Offline

Posts: 153

Thank You
-Given: 57
-Receive: 2


View Profile
« Reply #5 on: January 02, 2011, 07:18:32 AM »

Awesome Mate...its working great..now..

superb...i added those lines in legends.php and it worked...

Super Super THanks..

Keep Rocking mate..

Ty..
Logged
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 896

Vienna


View Profile WWW
« Reply #6 on: January 02, 2011, 07:23:35 AM »

i am glad....  Mr. Green
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.051 seconds with 21 queries.