[php]diffrent Type Of Template [id] With Includes ;)

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #13) by coldasice on Jan 5 2008, 10:09 PM. (Line Breaks Removed)
need somewaited many days be4 replay help?
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

[php]diffrent Type Of Template [id] With Includes ;)

coldasice
CODE
<?PHP

?>
<html>
<head>
<title>Example</title>
<style>
<!--
A { color: #003366; text-decoration: none; }
A:link { color: #003366; text-decoration: none; }
A:visited { color: #003366; text-decoration: none; }
A:active { color: #54622D; }
A:hover { color: #54622D; }


BODY,TD,TR{
font-family: verdana, arial, sans-serif;
color:#000;
font-size:11;
font-weight:normal;
}
.banner {
font-family: georgia, verdana, arial, sans-serif;
color:white;
font-size:x-large;
font-weight:bold;
border-left:1px solid #FFF;
border-right:1px solid #FFF;
border-top:1px solid #FFF;
background:#003366;
padding:7px;
}
.description{
font-family:verdana, arial, sans-serif;
font-size:x-small;
font-weight:bold;
}

//-->
</style>
</head>
<body bgcolor="#ffffff">
<div align="center"><center>
<table border="0" width="700" cellspacing="0" cellpadding="0">
<tr>
<td class=banner >
Put here your title<br>
<span class="description">and this is your description</span>
</td>
</tr>

<tr>
<td>
&nbsp;
</center>

<table border="0" width="100%" cellspacing="0" cellpadding="6">
<tr>
<td width="180" valign=top style="border-right: 1px dotted #000000;"><table border="0" width=93% cellspacing="0" cellpadding="0">
<tr>

<td width="100%" style="border-top: 1 solid #000000; border-bottom: 1 solid #000000" bgcolor="#F3F4F5" height="26">
<p align="left">&nbsp;<b><font color="#003366">Navigation</font></b></p>
</td>
</tr>
<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%">
&nbsp;<a href="">main page</a>
</td>
</tr>
<tr>

<td width="100%">
&nbsp;<a href="?do=admin">admin</a>
</td>
</tr>
<tr>

<td width="100%">
&nbsp;<a href="?id=$id">edit admin</a>
</td>
</tr>
<tr>

<td width="100%">
&nbsp;<a href="?do=main">other link</a>
</td>
</tr>
<tr>

<td width="100%">
&nbsp;<a href="">other link</a>
</td>
</tr>
<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%" style="border-top: 1 solid #000000; border-bottom: 1 solid #000000" bgcolor="#F3F4F5" height="26">
<p align="left">&nbsp;<font color="#003366"><b>Quick search</b></font></p>
</td>
</tr>
<tr>

<td width="100%">
</td>
</tr>
<tr>
<!-- The Quick Search Form -->
<form method="post">
<td width="100%" align="center">&nbsp;<br>
<input type="text" name="story" size="14">
<input type="hidden" name="do" value="search">
</td>
</form>
<!-- End of the Search Form -->

</tr>
<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%" style="border-top: 1 solid #000000; border-bottom: 1 solid #000000" bgcolor="#F3F4F5" height="26">
<p align="left">&nbsp;<b><font color="#003366">banners/sponsors</font></b></p>
</td>
</tr>
<center>

<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%">
&nbsp;put some banners here
</td>
</tr>
<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%">
&nbsp;and another banners here
</td>
</tr>
<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%" style="border-top: 1 solid #000000; border-bottom: 1 solid #000000" bgcolor="#F3F4F5" height="26">
<p align="left">&nbsp;<font color="#003366"><b>Friends</b></font></p>
</td>
</tr>
<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%">&nbsp;

</td>
</tr>
<tr>

<td width="100%">
&nbsp;<a href="http://news.google.com" target="_blank">Google News</a>
</td>
</tr>
<tr>

<td width="100%">
&nbsp;<a href="http://mozilla.org" target="_blank">Mozilla.org</a>
</td>
</tr>
</table>

<p align="center"><br><br>
<br>
<br>
<br>
</center>
</td>
<td width="520" valign="top" align="center">

<table border="0" width="453" cellspacing="1" cellpadding="3">
<tr>
<td width="441">
<?PHP

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here we decide what page to include
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

if($_POST['do'] == "search" or $_GET['dosearch'] == "yes"){ $subaction = "search"; $dosearch = "yes"; include("./search.php"); }
elseif($_GET['do'] == "admin"){ include("./admin.php"); }
elseif($_POST['do'] == "admin" || $_POST['&id'] == '$id') { include("./edit.admin.php"); } //tryed.. but dont work =D
elseif($_POST['do'] == "admin") { include("./admin.php"); }

?>
</td>
</tr>
</table>

</td>
</tr>
</table>
</td>
</tr>

</table><br><br><center>
<table border=0 width=700 style="border-top: 1px dotted #000000;">
<tr><td>
<p align="center">put your footer and copyright here

</td></tr></table>
</body>
</html>



well basicly what i wonder here is if this is a good way.. wink.gif

it works perfectly...

well another thing is.. it works with like do=asd

but how can i do . do=asd&id=1231&google=123

if its possible that is.. as u see i tryed.. ;O

 

 

 


Reply

jlhaslip
HA!... I thought the code looked familiar...

http://annex.trap17.com/scripts/targetframe/

Let me know if you want a copy of the script or Template. BH and I worked on that some time ago. We have a w3c valid div/css based version on the Annex site that does an Image swap based on the menu selection.

To answer your question about using several values in the Query string, handle the first element and then the second gets checked based on the first value, etc. essentially, you need to have nested if statement blocks.

CODE
if ( do == admin) { // first if block starts here
if ( add ) {
... add an id here ...
}
if ( edit ) {
... find the id number and edit it here...
}
if (delete ) {
... delete the id here ...
}
} // first if block ends here

Hope this helps.

Reply

coldasice
QUOTE(jlhaslip @ Dec 24 2007, 04:01 AM) *
HA!... I thought the code looked familiar...

http://annex.trap17.com/scripts/targetframe/

Let me know if you want a copy of the script or Template. BH and I worked on that some time ago. We have a w3c valid div/css based version on the Annex site that does an Image swap based on the menu selection.

To answer your question about using several values in the Query string, handle the first element and then the second gets checked based on the first value, etc. essentially, you need to have nested if statement blocks.

CODE
if ( do == admin) { // first if block starts here
if ( add ) {
... add an id here ...
}
if ( edit ) {
... find the id number and edit it here...
}
if (delete ) {
... delete the id here ...
}
} // first if block ends here

Hope this helps.


hmm.. didnt quite understand wink.gif


so u say if i do somthing like this`?

CODE
elseif($_POST['do'] == "admin") { elseif ($_POST['&id'] == '$id'){include("./edit.admin.php");} }


it will enter edit.admin.php with these tags? do=admin&id=1 ?

btw i guess u know where i found this.. can this be done inside the edit.admin.php or a function?

i just thought it way of doing this was awsome.. the other ones i just get blank side of.. nvm this.. just slipped.. <- delete smile.gif

 

 

 


Reply

jlhaslip
CODE
elseif($_POST['do'] == "admin") { elseif ($_POST['&id'] == '$id'){include("./edit.admin.php");} }

you need to complete one 'if' before the 'elseif'.
My code code have been done differently using elseif's:

CODE
if ( do == admin) { // first if block starts here
if ( add ) {
... add an id here ...
}
elseif ( edit ) {
... find the id number and edit it here...
}
elseif (delete ) {
... delete the id here ...
}
} // first if block ends here

Reply

coldasice
QUOTE(jlhaslip @ Dec 24 2007, 04:50 AM) *
CODE
elseif($_POST['do'] == "admin") { elseif ($_POST['&id'] == '$id'){include("./edit.admin.php");} }

you need to complete one 'if' before the 'elseif'.
My code code have been done differently using elseif's:

CODE
if ( do == admin) { // first if block starts here
if ( add ) {
... add an id here ...
}
elseif ( edit ) {
... find the id number and edit it here...
}
elseif (delete ) {
... delete the id here ...
}
} // first if block ends here



ARG!!! still dont get it....

can u post result.. on that one.. maby that clears it.. maby fill in the id.. -.- sorry im at a total stop -.-

Reply

delivi
the usage of TABLE for page layout is now not a standard. avaoid using tables and use only divs and add the style sheets in a seperate CSS file.

Reply

coldasice
QUOTE(delivi @ Dec 24 2007, 09:35 AM) *
the usage of TABLE for page layout is now not a standard. avaoid using tables and use only divs and add the style sheets in a seperate CSS file.


yeah i guessed so.... -.-

but its the function not the layout...

i have another look now that im awake =D

Reply

jlhaslip
A Table-less version of this script is available at the Trap17 Annex.
See the link in the pink bar above the Shoutbox. Select Annex > Scripts > Targetframes for the Demo.
or http://annex.trap17.com/scripts/targetframe/

Source code for the div-based layout is found at : http://annex.trap17.com/scripts/targetframe/index.phps

When there are multiple parts in the Query string, such as "?type=admin&act=edit&id=1234", the value of id is frequently used inside the php script as a value for data retrieved from a database, so you would not need to 'handle' the id = in the logic flow of the script.
Using the script logic I wrote above, I will demonstrate the use of a data value here:

CODE
if ( do == admin) { // first if block starts here
if ( add ) {
... add an id here ...
... present a form for inputting a new member here
... complete with the mysql code to insert the member into the Database

}
elseif ( edit ) {
... find the id number and edit it here...
... present a form here for editting a member's information
... and then update the Database with the information

}
elseif (delete ) {
... delete the id here ...
... using a mysql query, find the member with id = 1234  and delete the member's information

}
} // first if block ends here

As you can see, not everything in the query string affects the Logical flow of the script. in this example, id is a value for retrieving information from the Database.
Is that like what you plan on doing? This is a good example of 'dynamic' web site scripting. Instead of checking each and every value so you match an id, use the database features to write one set of scrpting code to perform a task based on the value passed in the query string. You do not need to write a code snippet for each id = value. Use the value to change the database.
Hope this helps.

Incidently, the above code will not run properly. It is called 'pseudo-code' and is used to represent the logic flow of a script/program only. the full scripting would need to be inserted in the correct places, etcetera. All the php and mysql is missing, but the pseudo-code explains what needs to be done at various spots. It is used to define a solution before the coding starts in order that you have an understanding of the solution and the methods to solve them.

Reply

coldasice
QUOTE(jlhaslip @ Dec 24 2007, 03:56 PM) *
A Table-less version of this script is available at the Trap17 Annex.
See the link in the pink bar above the Shoutbox. Select Annex > Scripts > Targetframes for the Demo.
or http://annex.trap17.com/scripts/targetframe/

Source code for the div-based layout is found at : http://annex.trap17.com/scripts/targetframe/index.phps

i think u all misunderstand me...
i dont care about layout......

i care about code...

jlhaslip.. i dont understand yours...

basicly this template comes from cutenews...
and when i press a link.. it uses template.. and get all links inside.. the ..

like when i press news... it goes template.com/index.php?do=news?id=12&mod=edit.. for example :=) <- this will show in adress bar and when it does it access page news with id2 and in edit mode =) <- example...

and all that happens in index template..



lets go over this again....

what i want to do when do=admin is show feks the admin.php

and when it shows do=admin&mode=edit&id=1 it shows the edit.admin.php where the user is id 1

think i formuled it better=?

and i dont know if this is written in the template.. or in the edit.admin.php =?

Reply

truefusion
QUOTE(coldasice @ Dec 24 2007, 10:58 AM) *
what i want to do when do=admin is show feks the admin.php

and when it shows do=admin&mode=edit&id=1 it shows the edit.admin.php where the user is id 1

The code i will show you is similar to what jlhaslip has been showing you this whole time:
CODE
<?php

$do = $_GET['do'];
$mode = $_GET['mode'];
$id = $_GET['id'];

if ($do == "admin"){ // if do=admin, do...

if ($mode == "edit"){ // if mode=edit, do...

if ($id == "1"){
include "edit.admin.php";
} else {
// do whatever...
}

} else if ($mode == "delete"){ // if mode=delete, do...

if ($id == "1"){
include "delete.admin.php";
} else {
// do whatever...
}

} else if ($mode == "add"){ // if mode=add, do ...

if ($id == "1"){
include "add.admin.php";
} else {
// do whatever...
}

} else { // if there is no mode set or if it is set with an "unknown" value, do...

include "admin.php";

}

}

?>


Do you understand how it works now?

Note: the code above has not been tested, but should still work.

Reply

Latest Entries

coldasice
need some

waited many days be4 replay smile.gif

help?

Reply

coldasice
QUOTE(truefusion @ Dec 27 2007, 12:30 AM) *
Going with the file names you have provided in this topic, it would go in admin.php, since edit.admin.php will be included.



hmmmm...


strange.. when i put this in my admin.php... it dosnt work..

but when i put it in a include file it works.. O.o

like

CODE
$do = $_GET['do'];
$mode = $_GET['mode'];
$id3 = $_GET['id'];

if ($do == "admin"){ // if do=admin, do...

if ($mode == "edit"){ // if mode=edit, do...

if ($id3 == "3"){
include "edit.admin.php";
} else {
include ('admin.php');

}
}
}


and put it in.. include.edit.php

and do like

in admin.php i do

include ('include.edit.php')

then i just refreseh admin.php and add the include in top.. ;=) it basicly works... but not the way its suppost when i use it as an include -.-
..
but when i add the pure code.. in to admin.php it dont work at all sad.gif(( <--- scratch that.. it works..

seems like it works =D..

btw if i put a hidden field or two in the form.... in admin..

can i then use that instead of those ifs?

question 2.

CODE
if($subaction == "new"){
echoheader("options", "New Template");

echo"<form method=post action=\"$PHP_SELF\"><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td >Create new template based on: <select name=base_template>";
foreach($templates_list as $single_template){
echo "<option value=\"$single_template\">$single_template</option>";
}
echo '</select> with name <input type=text name=template_name> &nbsp;<input type=submit value="Create Template">
<input type=hidden name=mod value=options>
<input type=hidden name=action value=templates>
<input type=hidden name=subaction value=donew>
</td></tr></table></form>';
echofooter();
exit;
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do Create the new template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "donew"){
if(!eregi("^[a-z0-9_-]+$", $template_name)){ msg("error", "Error", "The name of the template must be only with letters and numbers", "$PHP_SELF?mod=options&subaction=new&action=templates"); }
if(file_exists("./data/${template_name}.tpl")){ msg("error", "Error", "Template with this name already exists", "$PHP_SELF?mod=options&subaction=new&action=templates"); }

if($base_template != ""){ $base_file = "./data/${base_template}.tpl"; }
else{ $base_file = "./data/Default.tpl"; }

if (!copy($base_file, "./data/${template_name}.tpl")) {
msg("error", "Error", "Can not copy file $base_file to ./data/ folder with name ${template_name}.tpl");
}
@chmod("./data/${template_name}.tpl", 0777);

msg("info", "Template Created", "A new template was created with name <b>${template_name}</b><br>", "$PHP_SELF?mod=options&action=templates");
}

here i noticed.. these
<input type=hidden name=subaction value=donew>

if($subaction == "donew")

so do these 2 have any thing in common?
but why is name $subaction?.. and why cant i find any $subaction =.. only $subaction ==..

sad.gifsad.gif

Reply

truefusion
QUOTE(coldasice @ Dec 26 2007, 05:43 PM) *
but just wondering where to place this?????

like in my edit.. or just in my "template"?

Going with the file names you have provided in this topic, it would go in admin.php, since edit.admin.php will be included.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Pages: 1, 2
Recent Queries:-
  1. weight template.com - 706.77 hr back. (1)
Similar Topics

Keywords : php diffrent template id includes

  1. Template Chooser? - (10)
  2. Question About Php Includes - How would you include a frame AROUND the page? (17)
    I'm trying to make a layout for my website for the areas that aren't occupied by Wordpress,
    and I want to use PHP includes to do it. So far, I know how to use tags, like this: CODE
    <table> <?php include "sidebar.php" ?> </table> This is okay,
    but I want to be able to include everything in one "container" file. Kind of like this: For every
    HTML file that I include: CODE <html> <head> <?php include
    "frame.php" ?> <title></title> </head> <body> <!...
  3. Php Template Class I Started - and a good way to see how to fail template class (1)
    Althought it works, and maybe some users can even use this class for some simpler websites, this is
    not a good way to create class. I cant really explain why, and i'm publishing it so maybe people
    with more experience in template design can help me figure out how to create PHP templates. Looking
    forward for your answers. some of the variables and directories are in croatian, but i don't
    think that matters when you look at with programmers eyes. First my index.php file looks like
    this... CODE <?php     include ("includes/showSiteClass.php"&#...
  4. Error With Joomla Template - cant find function (1)
    Hello! I am working on my template in Dreamweaver and i am using joomla extensions for
    dreamweaver! When i start my page with joomla stand alone server(jsas) i get this errors on the
    bottom of the page! QUOTE Warning:
    mosloadcomponent(w:/www/Joomla/components/com_banner/banner.php) : failed to open stream: No such
    file or directory in w:\www\Joomla\includes\frontend.php on line 66 Warning:
    mosloadcomponent(w:/www/Joomla/components/com_banner/banner.php) : failed to open stream: No such
    file or directory in w:\www\Joomla�...
  5. Tpl (template System) And Php - Question (2)
    Hi all i search about tpl and php i want make and learn how can use tpl (template system ) in php do
    you link or tutorial ? plz post here or if you know plz paster here simple sample about php and tpl
    thanks more Proper spelling is required as a Trap17 member. Refrain from using slang spelling. ...
  6. Name The Customized Template - for my look and feel (12)
    i have a easy to use and easy to expand php look and feel but dont know what to name it. It allready
    has a great folder structure and some ok tools. Also you can make your own extensions and change
    allmost EVERYTHING. I have bg images, bg colors, nice look but it uses tables. i have it currently
    working in firefox and IE, the only good ad free browsers. Original title "I Need A Name." What
    you need is better topic title. This is the only caution note. ...
  7. Secure Page Includes Non-secure File - (1)
    The basic page layout I am working with has several includes on it (header.php, rightcolumn.php,
    leftcolum.php and so on), and it is on httpdocs folder. I have also instanced some classes wich I
    call at the beginnig of the home page. My problem arises when I try to run another page wich is
    supposed to be secure (placed, obviously, at httpsdocs folder), and both secure and non-secure page
    has the same layout?. What should I do? Make exact copies of the included files, classes and images
    inside the secure folder? Is there a way to call my classes, includes from SSL folder...
  8. Garbage Text - when i added php includes to a page (2)
    When i added php included to a page, it produced this really really weird garbage text befor and
    after the table i have on the page. I was wondering if this has ever happened to anyone else. Not
    sure what's producing the gargabe, i mean it's only a couple of characters, and i've
    gone through everything and can't find anything. The other thing is that i can, and have gotten
    rid of it by getting rid of the text befor the php include code which isn't a solution becasue i
    want to keep the meta's and title on the page. this is what the garbage looks li...
  9. Extra Page With Same Template - (0)
    I've installed Coppermine (online photoalbum manager) on My Webpage but i would like to add an
    extra(s) page with other content. I mean, building an extra page with the same template/theme in in
    the site. I guess some scripts have to be copied into a new page, but i don't know which ones...
    I'm not familiar (enough) with coding.. The menu,backgroundcolor, css and footer should be the
    same.... I hope someone can help me with this, thanks in advance! /cool.gif' border='0'
    style='vertical-align:middle' alt='cool.gif' /> (spread the knowledge /wink.gi...



Looking for , php, diffrent, type, template, id, includes,

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for , php, diffrent, type, template, id, includes,

*MORE FROM TRAP17.COM*
advertisement



[php]diffrent Type Of Template [id] With Includes ;)



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE