Click here to Skip to main content
15,892,480 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
QuestionNot able to debug my application Pin
PeriyasamyRamachandran3-Dec-10 3:37
PeriyasamyRamachandran3-Dec-10 3:37 
QuestionNot able to log in - Fatal error [modified] Pin
PeriyasamyRamachandran2-Dec-10 22:25
PeriyasamyRamachandran2-Dec-10 22:25 
QuestionUsing Perl to automate the software installation build process Pin
Blair Symes2-Dec-10 6:34
Blair Symes2-Dec-10 6:34 
Questionbreadcrumbs Pin
AndyInUK29-Nov-10 23:21
AndyInUK29-Nov-10 23:21 
AnswerRe: breadcrumbs Pin
cjoki30-Nov-10 6:26
cjoki30-Nov-10 6:26 
GeneralRe: breadcrumbs Pin
AndyInUK1-Dec-10 5:48
AndyInUK1-Dec-10 5:48 
GeneralRe: breadcrumbs Pin
Luc Pattyn1-Dec-10 6:15
sitebuilderLuc Pattyn1-Dec-10 6:15 
GeneralRe: breadcrumbs [modified] Pin
cjoki2-Dec-10 6:29
cjoki2-Dec-10 6:29 
id   page     parent
1    index    0
2    about    1
3    products 1
4    cars     3
5    trucks   3


If you name the lookup the same as the real page minus the extension you can build any part of the pathway dynamically.
You will need an array to keep track of the full path at each part of the breadcrumb.

so the array would need to look like this
<?php
  $bc_arr = array();
  $depth_guage = 0; // this is used to measure the relative path depth
  $home_not_found=true; // home is any top level page marked aa zero in the database table.
  $cur_pg_name = ""; // set to a name of the current page dynamically...

  while($home_not_found)
  {
    // I have not tested this query, but I hope you can follow the logic. If it does not work you may need to split the logic out.
    $sql = "select pr1.*, (select pr2.page from page_relations as pr2 where pr2.id=pr1.parent) as parrent_name, (select pr2.parent from page_relations as pr2 where pr2.id=pr1.parent) as grandparent from page_relations as pr1 where page='".$cur_pg_name."'";
    $rst = mysql_query($sql) or die(mysql_error();
    $row = mysql_fetch_row($rst);

    // if the grand parent is == 0 then stop the loop.
    if($row['grandparent']==0)
    {
      $home_not_found=false;
      //.. build and assign breadcrumb link to array. see below
      //.. also include parent link
    }
    else
   {
      //...build and assign breadcrumb link to array. see below
      //...assign parent name to $cur_pg_name
   }
    // you are below, this should be in the if/else of the loop
    //...each pass
    array_push($bc_arr,"<a href='".str_repeat("../",$depth_guage).$row['page'].".php'> > ".$row['page']."</a>");
    $depth_guage++;
?>


once you are out of the loop that builds your breadcrumbs you can step back though it and echo the results.

again I have not tested this code, but it is the general idea on how I have done it in the past.

modified on Thursday, December 2, 2010 12:36 PM

AnswerRe: breadcrumbs Pin
Christian Mattix18-Jan-11 9:27
Christian Mattix18-Jan-11 9:27 
Questionis (mySQL)INSERT function limited in the number of Variables and Values? Pin
bijan.8k24-Nov-10 9:40
bijan.8k24-Nov-10 9:40 
AnswerRe: is (mySQL)INSERT function limited in the number of Variables and Values? Pin
Luc Pattyn24-Nov-10 10:13
sitebuilderLuc Pattyn24-Nov-10 10:13 
AnswerRe: is (mySQL)INSERT function limited in the number of Variables and Values? Pin
cjoki24-Nov-10 11:07
cjoki24-Nov-10 11:07 
QuestionHow to iterate form-fields on a page and send them to database? [modified] Pin
jasonmp20-Nov-10 16:26
jasonmp20-Nov-10 16:26 
AnswerRe: How to iterate form-fields on a page and send them to database? Pin
cjoki22-Nov-10 4:49
cjoki22-Nov-10 4:49 
QuestionHow to GET embedded video by using an URL which has embedded video? Pin
nicholasng20-Nov-10 15:40
nicholasng20-Nov-10 15:40 
Questionhow to implement indian payment gateway Pin
pallavi shrivastava16-Nov-10 18:29
pallavi shrivastava16-Nov-10 18:29 
QuestionRe: how to implement indian payment gateway Pin
Gerben Jongerius16-Nov-10 20:23
Gerben Jongerius16-Nov-10 20:23 
QuestionHow to convert php script to .exe Pin
udch12-Nov-10 23:54
udch12-Nov-10 23:54 
AnswerRe: How to convert php script to .exe Pin
cjoki15-Nov-10 4:37
cjoki15-Nov-10 4:37 
AnswerRe: How to convert php script to .exe Pin
Mohamed7IBrahim18-Nov-10 3:21
Mohamed7IBrahim18-Nov-10 3:21 
GeneralRe: How to convert php script to .exe Pin
cjoki18-Nov-10 5:27
cjoki18-Nov-10 5:27 
AnswerRe: How to convert php script to .exe [modified] Pin
DaveX8622-Nov-10 7:32
DaveX8622-Nov-10 7:32 
QuestionSending FILE post data through PHP code Pin
Yulianto.10-Nov-10 18:55
Yulianto.10-Nov-10 18:55 
AnswerRe: Sending FILE post data through PHP code Pin
cjoki12-Nov-10 4:22
cjoki12-Nov-10 4:22 
AnswerRe: Sending FILE post data through PHP code Pin
Graham Breach12-Nov-10 4:37
Graham Breach12-Nov-10 4:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.