Creating Hierarchy Of Links To Parent Categories?..
Hi
I've attempted to create a set of links to my pages which displays all higher level (parent) categories.
Something like this:
Top > Category1 > Category2 > Category3 > Category4
With Category4 being the title of the current category being displayed. Only the higher level categories should be links, ie Category4 in the example should be just text and not hyperlinked.
My attempt so far is the code below. It sort of works, but only displays the current category (as text) and it's parent (as a link).
As you descend ito the catalog, the higher levels are not visible.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Automaticaly Displaying Links In Several Categories
I've put together two functions that pull a list of categories from a db which are hyperlinked to all of the links that correspond to that particular category. And two almost identical functions that display the links. What I would like to do is to have the category names echoed out with all of it's respective links automatically under it as opposed to clicking the category to see them. PHP Code:
Creating A Parent->child Tree
Does anyone know any good tutorials on creating a parent->child tree? Ive looked through google but cant seem to find any?
Creating Links Out Of Db Content
I have a db that looks like: field: apartment field: city field: link At this point I'd like to construct a script that will pull a keyword out of the url string, and grab the "apartment" and "link" fields that correspond (matched by category), and display them in link form on a page. I have the script down so it will grab the keyword it needs, and the select statement that will grab the two fields. My question is. Once I have the $result , how can I parse them to use the way I'd like....each city with it's corresponding link...displayed. while? For? List?
Creating Links Out Of Terms On The Fly
I want to run a website with definitions. when text else where on the website is displayed, i want to automatically find all words that we have definitions for and then display a javascript mouse over (which is organised by a div tag which i already have the code for) I have no idea where to start and would appreciate a starting point. what would you call this procedure? I couldn't find anything on google that could help. i've struck a blank.
Creating Links From Db Content
I am trying to extract a field from one of my tables, and with that value, create a link to another page. for example, i am listing all my users in my database. Then, with that username at the text for the link, i create a link to their profile page. at the moment i have the following code to select the usernames from my table:
MySQL Creating Links From Query
As I am still learning PHP could someone tell tell me how to achieve the following? Display only the first four records from a sql query and have 'next page' links and number of pages so users can navigate the next four records and so on. The usual navigation you find on search engines. I have the query and the num_rows function, I just need to know how to implement it.
Remove File Extensions Before Creating Links
i have some working code here that creats a list of links in the noted directory, but i would like it to remove file extenions. they are all word docs. also is there a way to force it to open in the browser? all computers will be running latest IE6 and maybe IE 7 in the future. Code:
PHP 4: Does Method_exist Return True If Parent Class Method Even If Child Class Forgot To Call Parent::
My code was dying on the line below where I use method_exists: if (class_exists($nameOfClassToBeUsed)) { $object = new $nameOfClassToBeUsed(); $this->arrayOfAllTheObjectsSoFarLoaded[$nameOfClassToBeUsed] = & $object; if (method_exists($object, "setCallingCode")) $object->setCallingCode($nameOfFunctionOrClassCalling); return $object; } else { $this->error("$nameOfClassToBeUsed not found. The code that wants this class is $nameOfFunctionOrClassCalling "); } The method is in the parent class yet I'd forgotten to call parent:: in the constructor of the child class. It seems to me that method_exists was testing true, though the method was not truly available, and then the code died. Adding parent:: to the constructor of the child solved the problem. Is this a bug in PHP?
Creating "dynamic" Links
I am creating a directory of local business where I live and need some help on the navigation I want to build for the site. How it works: I have 8 categories at the top of the page (Dining, Bars, Entertainment, etc). When a user clicks on say the Dining button, it loads client_list.php and lists all businesses under that category. Then on the left it loads a list of the sub categories (Pizza, Chinese, Fast Food, etc). I have all that working, but what I want to do is when a user clicks on one of those side categories it loads a page called client_filter.php and loads only the businesses under that sub-category (say all the businesses under Pizza). Now I have that link code partially done: client_filter.php/?category=$category_num& but how do I code in the sub_category id number so that is only displays the Pizza places. If any needs to see any of the other code just let me know. Just don't want to show to much for security and such.
User Hierarchy
in developing a user hierarchy for a script that i'm developing. I'm developing an eTimeCard where i only want the ground user to make edit's to his/her card. Therefore i just need an idea of how to implement that superior user idea.
Hierarchy Using MySQL And PHP
I am having a HUGE problem doing a new hierarchy system for a company. Basically, the system they currently have is based on a parent reference. Here is the table structure dump: CREATE TABLE `associate` ( `id` int(99) NOT NULL auto_increment, `code` varchar(99) NOT NULL default '', `date_hired` int(10) NOT NULL default Ɔ', `last` varchar(32) NOT NULL default '', `name` varchar(20) NOT NULL default '', `middle` varchar(20) NOT NULL default '', `title` varchar(4) NOT NULL default '', `level` varchar(5) NOT NULL default 'LO', `street` varchar(250) NOT NULL default '', `city` varchar(50) NOT NULL default '', `state` varchar(50) NOT NULL default '', `zip` int(5) NOT NULL default Ɔ', `hphone` varchar(15) NOT NULL default '', `cphone` varchar(15) NOT NULL default '', `fax` varchar(15) NOT NULL default '', `email` varchar(250) NOT NULL default '', `wfmemail` varchar(250) NOT NULL default '', `dob` int(10) NOT NULL default Ɔ', `dlid` varchar(20) NOT NULL default '', `ss` varchar(15) NOT NULL default '', `sponsor_code` varchar(99) NOT NULL default '', `wfl` char(1) NOT NULL default '', `wbs` char(1) NOT NULL default '', `wis` char(1) NOT NULL default '', `lft` int(99) NOT NULL, `rgt` int(99) NOT NULL, PRIMARY KEY (`id`) ) Basically, sponsor_code matches the code of the parent for that associate. The problem is that this system is very inefficient. Now I'm trying to incorporate a new system following the guide at: http://dev.mysql.com/tech-resources...hical-data.html I have changed everything so it has the lft and rgt and the numbers seem to be correct. I tried doing an upline for any of the associates and it works perfectly. The problem is doing the downline. When I do that it seems to skip the first generation and then the generation numbers mess up on some of the rows. You can see the query and the downline report from the top of the tree (ID 820) at https://dev.mywfm.com/tree.php The fields included are gen, id, code, left, and right. Also, here is a dump of the downline using the old system so you can take a look at what the data is supposed to be like: https://dev.mywfm.com/dl.php
Storing A Hierarchy In An Array
I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array( "name", "title", "reports to user id", "start date in the format: mm/dd/yyyy" ) ); How can I display this hierarchy in simple nested <li> tags in the most efficient way possible? I realize that the way this is setup, the hierarchy is essentially a tree. But I am at a loss as to how to pull this data out, sort it, and display it wit nested <li> tags. I am thinking that this is more of a computer science problem.... What I mean by displayed as a hierarchy, is that the nested <li> tags will indent themselves to look like that. Like this: - CEO -- Manager --- Manager's secretary --- Minion -- Manager That sort of thing. I am just lost as to how I can analyze the structure of the array and turn it in to output like that.
XML/DOM Deleting Childnodes/hierarchy
I have a problem concerning DOM and XML. The structure of my xml is the following: <?xml version="1.0" encoding="utf-8"?> <website> <language1> <seite> <bereich1> <text></text> <link> <link></link> </link> <link> <link></link> </link> <link> </link> </bereich1> <bereich2> </bereich2> </seite> </language1> </website> if I change and save the contents of the link-tags, there is no problem. (to change the value of a link, I simply select them by getElementsByID and loop them in a for-loop). But if I have to delete one of them, it seems that the hierarchy somehow causes trouble, a "not found error" occurs. If there is only a list of links, which doesn't contain other links, the deleting works. My question: why does the principle of the for-looping work with changing the values of the link, but doesnt work when i want to delete them? The code for deleting: $DeleteIt=(int)$DeleteIt; if($Sprache=="Deutsch") $parent = $dom->getElementsByTagName('language1')->item(0); else if ($Sprache=="Englisch") $parent = $dom->getElementsByTagName('language2')->item(0); $parent2=$parent->getElementsByTagName('seite')->item($Seite); $parent3=$parent2->getElementsByTagName('bereich1')->item(0); $toDelete=$parent3->getElementsByTagName('link')->item($DeleteIt); $okay = $parent3->removeChild($toDelete); if I replace the last two lines by: $toDelete=$parent3->getElementsByTagName('link')->item($DeleteIt)->nodeValue; echo $toDelete; the value of the link that has to be deleted is given - this works.
Site Hierarchy Context Pointers In The Banner Of A Page
I'm trying to implement one of those site hierarchy context pointer thiniges in the banner of a page. The type that has links up to the parent and the grandparent. You know the sort of thing: Section A -> Sub-section A.1 -> Page 42 I want to do some research into it first. The technique has a specific name but I can't remember what it's called?
Reading Categories
I have a text file called cat.dat which contains the username and the categories they have selected. Another file users.dat is for username and password. Now, my authentication part is working fine, but I can't read the cat.dat file to get their selected items.
Multiple Categories
I am looking for a tutorial, or some help with a slight problem that I am having. What I need to do is create a bit of code that will allow me to select multiple categories for a product. I all ready have it so I can pick form a list of categories and unlimited sub categories. Now I need it so I can select mutable categories from a list, and the product gets displayed on them all. I am using MySQL and PHP for this.
Multiple Categories
i am creating a directory of local business and need a bit of help on something. I want to have it where a client can belong to more than 1 category or sub-category. The categories for example are Restaurants, Entertainment, etc. Then under Restaurants you have something like Greek, Italian, etc as the sub-categories. So I have 3 tables. The categories table with the cat title and id number. (there are only 7 categories) The sub categories table with the sub cat title, id number and the number of the category it belongs to. Then I have the client table that contains the client info such as business name, address, etc. In there I have a field for the category and sub category where I fill in the correct number. So if it is a restaurant (cat 1) and an Italian restaurant (sub cat 7) I fill in the correct fields with those numbers. Now with some clients I want to have them say under Restaurants and sub cat Italian and Caterers. When I try putting in 4,45 in the subcategories field of the client table it erases the ,45. So what can I do to fix this? (so that a client can belong to more than one sub-category.
Paginating Categories
i have small problem here, when aa user browses a specific category i wanted to paginate THAT category, as a test i set the display per page to 5 so if i have 15 items in the database the links are correct they show: Code:
How To Count Links To External Links?
I get results of the query diplayed on my find.php page with links to different web sites. I want to store count of clicks on each of those links that are displayed on my find.php page. How can I do that?
Outputting Data In Categories
I'm trying to organize some data into categories. Lets say for example we have this: while ($row = mysql_fetch_assoc($result)) { $data1 = $row["field1"]; $data2 = $row["field2"]; $data3 = $row["field3"]; $data4 = $row["category"]; echo $data4?><br><?php; echo $data1,$data2,$data3?><br><?php; } Which would have a sample output like this: Category1 Field1Field2Field3 Category1 Field1Field2Field3 Category2 Field1Field2Field3 Category2 Field1Field2Field3 How would I get it to print the category name once, then everything belonging to that category, then move to the next category, etc. So it'd look like this: Category1 Field1Field2Field3 Field1Field2Field3 Category2 Field1Field2Field3 Field1Field2Field3 That's the simplest way I can think of putting it. :) Seems to me like it'd be an easy answer, but I've tried a couple of different approaches and can't seem to get it to work.
Categories In Html Form...
Is there any easy way to select a coulmn (categories) from a mySql Database and put it into a dropdown box in a html form to be used to add to the table, this way they wouldn't have to type in the category and just select it from a dropdown box. I need to do this in a way that it won't select every category as there could be 3 rows with dogs as the category, I only want dogs to show up once.
1 Menu/12 Categories/1 PHP Page
I'm trying to replicate this type of php coding here. <snipped url> Basically, it's a simple menu on the left side that retrieves the info of a table (cat) and 12 different fields (ex: Area Guides, Business, etc...) containing web site addresses. My question to you is, how can we use the same php page (res.php in this case) to retrieve the content of 12 different fields? You see, I would have created 12 different php pages while this guy managed to use only one page to do it! Could you please tell me how he did it and maybe paste me some php code to do something similar?
10 Results Per Page But From Different Categories
I have a script that shows a list from a different category depending on what is in the URL. I've got it to limit the results to the 1st ten results and keep the chosen category in the link(?category=differentcategory) but when next page is clicked it repeats the same ten results. Code:
XML With N Numbers Of Nested Categories
I have a XML which can have n number of nested categories and subcategories. The problem is node names are all same for each level. Now can any please tell how can I display names with relation between each? Code:
Pulling In One Item Of Four Categories
Ive got an offers table which contains name, category_id I want to display all offers, however the first page will only display four offers (one of each category). My query is as follows so how do I do this part? Code:
List All Sub/Sub-Sub Etc.. Categories (Category Tree)
I'm trying to list category tree, but I'm having problems listing sub-sub.. categories. This is my Category field: +-------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+----------+------+-----+---------+----------------+ | ID | int(11) | NO | PRI | NULL | auto_increment | | NAME | longtext | YES | | NULL | | | P_ID | int(11) | YES | | NULL | | +-------+----------+------+-----+---------+----------------+ This is my code So far: Code:
How Do I Create Categories For A Blog Post?
I created a very simple shoutbox. User posts their name and a message and clicks post. It posts to the database and when the page reloads, the "shout" is displayed. I would like to add categories to this little shoutbox application I created. The user should be able to check off boxes to apply different categories to a post. For example a shout could be in the categories, php,mysql,html and css. Logistically how do I do this using MySQL and PHP? ... Obviously this is just a project for learning and has no real application.
Displaying A List Of Categories From A Database In A Select Box
Could someone please tell me why this outputs nothing <select name=categories> <? $cat_array = get_categories(); foreach($cat_array as $this_cat) { echo "<option value=""; echo $this_cat["category_id"]; echo """; echo ">"; echo $this_cat["category_name"]; echo " "; } ?> </select> ========================================================== function get_categories() { //get the list of categories from the database $conn = mysql_pconnect("localhost", "user", "pwd"); $query = "select * from categories"; $result = mysql_query($query); if(!$result) return false; $num_cats = mysql_num_rows($result); if($num_cats == 0) return false; $result = db_result_to_array($result); return $result; } //A function that returns a query to the database as an array function db_result_to_array($result) { $res_array = array(); for($count=0; $row=@mysql_fetch_array($result); $count++) $res_array[$count] = $row; return $res_array; }
I Have Sub-categories But Want To Display Full Category Path
Let's say I have a simple web application running with just two MySQL tables. The tables structure is as follows: Table: category category_id (PK) category_name parent_category (FK) //references category_id in this table Table: link link_id (PK) link_name link_description category_id (FK) //references category_id in category table Here is the data in the category table 1, England, 0 2, West Yorkshire, 1 3, Batley, 2 4, Leeds, 2 5, Bradford, 2 As you can see Batley, Leeds and Bradford are sub-categories of West Yorkshire which itself is a sub-category of England. What I want to display when I am browsing through sub-categories of links is not only the name of that sub-category but it's category's parents, grand parents and so on like the below example. UK >West Yorkshire >Batley I see this on a lot of directory sites but none of my PHP books cover how this is done. Must be quite simple so can someone please point me in the right direction. Hope I've explained it well enough, haven't a clue what this process is called.
Blog Software With Many Registered Users Categories
I have a blog made with b2evo, but I'd want to migrate to another software. I need this feature: different user levels, and each level see only the posts intended for them. I'd want to be able to do posts for everyone, posts for customers, posts for friends and posts for close friends. The user levels deployed in b2evo and Wordpress seem only to limit editing and blogging, but not readability of the posts (actually, in b2evo you may limit the visibility of a post to the registered users, but all of them, not a category). The only tool I know who could enable me to do that is typo3, but frankly, installing typo3 for a blog seem a bit of a overkill to me... Do you know any blog software who enable the owner to have different levels of visibility for each post?
Pop-up To Add Data To Parent?
Does anybody have some code or can you point in the right direction to getting some for the following task I'm trying to accomplish. Let's say I have a list of items on a page (say job codes) and in order to add a new job code, the user clicks on a button titled 'add new job codes'. When the user clicks on this button, a popup appears with dialog stating 'Add new Job Code' with a text input box and a submit button. The user then adds the job code, and when he clicks submit, the pop-up box disappears, and the data that was entered now appears in the list of job codes on the original parent window. Is this hard to do? Does it take javascript code?
Get Parent Directory
i do dirname(__FILE__) and i get for example /usr/local/a/b/c/d/e I need to get from this /usr/local/a/b/c How do i go about that?
Displaying The Parent Folders Name
Say there is an url like this for example: www.mydomain.com/pics/b/basketball/index.php using php, is there a way to just display the word basketball in the index.php file? I would also need to display it in the title tags like this: <title>Basketball pics</title>
Vars From Parent Class
1. Folks I have a parent class cMySQL the handles basic mysql queries and connection ... 2. I have a child class cGetMenu which uses methods of parent class for accessing mysql 3. in cGetMenu class the constructor checks if the given menu table is of appropriate structure:
Child Construct Parent
I'm building out a OO based app in PHP 5 but I'm getting a little confused on children contructing parents. I have a parent that looks like this: abstract Class State { protected $database; protected $user; protected $output; public function __construct($database,$user,$output) { $this->database = $database; $this->user = $user; $this->output = $output; } } And a child that looks like this: Class Status extends State { public function __construct($database,$user,$output) { parent::__construct($database,$user,$output); } } This seems to work OK. But I'm getting confused when thinking about adding a new child who then has to contruct the parent again. Isn't this getting away from the whole purpose of inheritence? It seems like this is recreating the parent with every new child that come along. Would it be possible to just have a single instance of the parent that all children extended or am I missing the point here?
Opendir() And Files Below Parent
I am trying to use some functions to opendir and readdir with the file /root/desktop/www/list.php when I try to read the contents of /root/mysql_backups/ I only get the names of the file, and the file size and date say:
How To Get Parent Directory From String
I am trying to write a snippet of code that will get the parent directory of a given string. For example, the string might be $string = "/public_html/images/" and I need something that will return "/public_html/".
Parent Refreshed By Child Window
I wonder if I could refresh parent window in PHP when I close child. I know that I can refresh but I need to keep entered data which I have in parent window.
Access Parent Method Php4
I have two classes: class Base { function Insert() { // does stuff } } class Derived extends Base { function Insert() { // does some different stuff parent::Insert(); // then calls base class } } Now, in main line code I want to do this: $der = new Derived(); $der->parent::Insert(); // I want to call the base class's Insert method - doesn't work $der->Base::Insert(); // this doesn't work either Is it possible to access a hidden parent class method with a child class object in PHP4?
Getting Data From Another Window Without Refreshing Parent
I have a form with some text fields and select menus. Also in the form, the user can click on a link that opens a pop-up window with a list of clickable names. The pop-up window registers the id of the name they click on into a session variable so when the form in the parent window submits, it remembers the data. Can I do this: a) without sessions b) without refreshing the parent page Also, I realize that it would easier to make the list of names part of the parent page, but for many reasons I can and will not, so please don't suggest that.
Includin Files In The Parent Directory
Here is my file index.php: <?php include "../parent.php"; ?> When I try to run this code on a Linux server, it gives me the following error message: Warning: main(): open_basedir restriction in effect. File(../ parent.php) is not within the allowed path(s): (.) in 192.168.1.16webfilesfiles2007-61475215innerindex.php on line 3 Warning: main(../parent.php): failed to open stream: Operation not permitted in 192.168.1.16webfilesfiles2007-61475215inner index.php on line 3 Warning: main(): Failed opening '../parent.php' for inclusion (include_path='.;c:phpincludes') in 192.168.1.16webfilesfiles 2007-61475215innerindex.php on line 3
How To Access A Function Of A Parent Class ?
if i access a function of a class, i do this : $x=new Class; $x->function(); how do access a function of a parent class ?..let's say, class "Class" has a parent class "Parent" and "Parent" has a function n(). how to access n() from Class above ?
Include File In Parent Folder
I want to include a certain file that's in a parent folder. For example, the file "config.php" is located in public_html/ and the file i'm including it in is in public_html/admin/ How do I include public_html/config.php in public_html/admin/index.php?
Parsing XML Using XPath: Getting Parent/child Values
I am using PHP and XPath to parse an XML value. I found a tutorial that showed me how to get node values for each node, but I need to get them by parent/child node relationships. I'll show you what I have below, so I can explain better: Code:
Script To Logout And Close The Parent Window
I have a LOGOUT button in a frame on a php page. I want a script such that after i click the LOGOUT button, the user is directed to the logout.php page after successfully closing the parent window.
XML Parser Class With Reference To Parent Element
I have been looking for a PHP5 class like SimpleXMLElement with the additional feature of being able to reach the parent of its element node. For example consider the following example: $xmlObject = simplexml_load_string(<<<END <book> <chapter id = "1"></chapter> <chapter id = "2"></chapter> </book> END ); function foo($xmlObject) { // here I would like to be able to access book from element chapter // for instance something like this: // $parent = $xmlObject->getParent() // or: // $parent = $xmlObject->book } foo($xmlObject->chapter[0]); I have already tried searching with Google and have already looked at PHPClasses.org but I have not found anything. In spite of this I am sure that a solution only I cannot find it.
PHP5: Using __CLASS__ Within __toString In Parent Class
I have a little problem. The method __toString() inherits as expected on all sub-classes but the __CLASS__ constant returns only the name of the parent class where the method is defined. class Base { public function __toString() { return 'Type: '.__CLASS__.', Class: '.$this->name.' (Level: '.$this->level.')' } } class SubClass extends Base { // something } $obj = new SubClass(); echo $obj; // -displays "Base" Is there a way to get around this?
|