I have some topics displaying on my page and when i click on each topic there are several sub-topics displayed.Now, when I click on a sub-topic, the content of that sub-topic is displayed.
Now, i want to display a header or a heading on each of my content when it is displayed.
I can add up this heading in my content file because its a simple html file, but i dont want to do in this way.There are new articles which will be added periodically into the database and some are deleted.
Let me give an example:
Humour is my main topic which is on my navigation bar.When i click on humor, I get displayed two sub topics called cartoons and comedy.
Under cartoons and comedy, there are several articles:Now, when i click on each article, the content is displayed and on top of this, I need to display a simple heading like: Humor.Well, this gives an idea to the user that this articles belong to the main topic humor.
Any ideas how i can do this??
Thanks in advance
heading
Moderator: General Moderators
you use DHTML or Javascript to make the navigation menu or you load a different page depending on the link the user clicks?When i click on humor, I get displayed two sub topics called cartoons and comedy.
when you display an article, you retrieve it from the database by an ID (probably made by concatenating the all the topics' IDs) so the simplest way of doing this is by using the ID.
eg.
cat 'Humour' -> database ID 1
sub cat of Humour 'Cartoons' -> database ID 1_1
sub cat of Humour 'Comedy' -> database ID 1_2
article 'whatever1' of category 'Comedy' -> database ID 1_2_1
article 'whatever2' of category 'Comedy' -> database ID 1_2_2
article 'whatever3' of category 'Comedy' -> database ID 1_2_3
when you need a reference to an article you use it's unique ID. by separating the ID in the composing parts you can get it's 'path'. therefore article 1_2_2 belongs to 'Humour -> Comedy'.
hope this clears things up a bit... if you need more help, just ask for it.
-
minds_gifts
- Forum Commoner
- Posts: 63
- Joined: Mon Feb 10, 2003 4:23 am
Hello,
Thanks.But, this url gives you an idea what exactly what I'm trying to do.But, this is purely html.I'm trying to do all this in PHP.
http://www.sarath.iwebland.com
Courses is a topic name.Major subjects is a subtopic name.Communication engineering is a article name and when you click on comm.engg, you see a text displaying with a heading which has brown background and on it stating "courses" on the left side and "back".I just want to put this heading automatically when i click any article name corresponding to that particular topic.
What I'm doing is
1 - Get all the topic names from the table on the navigation bar.
2 - Click on a topic name and show the sub-topic name and below that show all the article names corresponding to the sub-topic.Click on the article name and show the article content.
How my table structure looks like:
1.topic(topic_id, topic_name)
2.subtopic(subtopic_id, topic_id, subtopic_name)
3.article(article_id, topic_id, subtopic_id, article_name, article_content)
Let me give one example:
topic_id : 1
topic_name : courses
subtopic_id : 1
subtopic_name : main subjects
article_id : 1
article_name : communication engineering
article_content : text1.html
So, now text1.html file will display when you click on communication engineering.
"STRICTLY, I DONT WANT TO PLACE THIS HEADING IN THE TEXT1. FILE BECAUSE THERE ARE SO MANY ARTICLE NAMES AND I WANT TO SHOW THE HEADING AUTOMATICALLY ON THE ARTICLE CONTENT WHEN I CLICK ON ANY ARTICLE NAME CORRESPONDING TO THAT TOPIC".
I want to implement the same heading as i showed in the above url.
Please guide me.
Thanks everybody.
Thanks.But, this url gives you an idea what exactly what I'm trying to do.But, this is purely html.I'm trying to do all this in PHP.
http://www.sarath.iwebland.com
Courses is a topic name.Major subjects is a subtopic name.Communication engineering is a article name and when you click on comm.engg, you see a text displaying with a heading which has brown background and on it stating "courses" on the left side and "back".I just want to put this heading automatically when i click any article name corresponding to that particular topic.
What I'm doing is
1 - Get all the topic names from the table on the navigation bar.
2 - Click on a topic name and show the sub-topic name and below that show all the article names corresponding to the sub-topic.Click on the article name and show the article content.
How my table structure looks like:
1.topic(topic_id, topic_name)
2.subtopic(subtopic_id, topic_id, subtopic_name)
3.article(article_id, topic_id, subtopic_id, article_name, article_content)
Let me give one example:
topic_id : 1
topic_name : courses
subtopic_id : 1
subtopic_name : main subjects
article_id : 1
article_name : communication engineering
article_content : text1.html
So, now text1.html file will display when you click on communication engineering.
"STRICTLY, I DONT WANT TO PLACE THIS HEADING IN THE TEXT1. FILE BECAUSE THERE ARE SO MANY ARTICLE NAMES AND I WANT TO SHOW THE HEADING AUTOMATICALLY ON THE ARTICLE CONTENT WHEN I CLICK ON ANY ARTICLE NAME CORRESPONDING TO THAT TOPIC".
I want to implement the same heading as i showed in the above url.
Please guide me.
Thanks everybody.
- daven
- Forum Contributor
- Posts: 332
- Joined: Tue Dec 17, 2002 1:29 pm
- Location: Gaithersburg, MD
- Contact:
There is no real way to do what you want with PHP. PHP is a server-side technology, not a client-side one. ie--your DB stuff can be done with PHP, but none of the client interactions. That being said, the best way for you to do this would be with javascript and arrays.
The url you posted uses Frames. You can do this if you want, although I tend to advise against it. Frame1=topic, Frame2=subtopic, Frame3=article. Click on topic in Frame1 to change source of Frame2. Click on subtopic in Frame2 to change source in Frame3. Click on link in Frame3 to view article. As I said, this is possible, but it tend to be ugly (code-wise).
The url you posted uses Frames. You can do this if you want, although I tend to advise against it. Frame1=topic, Frame2=subtopic, Frame3=article. Click on topic in Frame1 to change source of Frame2. Click on subtopic in Frame2 to change source in Frame3. Click on link in Frame3 to view article. As I said, this is possible, but it tend to be ugly (code-wise).