Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8763227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:43:59+00:00 2026-06-13T15:43:59+00:00

I’m new to programming, trying to make simple cms: A index.php display all article

  • 0

I’m new to programming, trying to make simple cms:

A index.php display all article subject,
user click subject to show content in Fancybox, not forward to new page.

I made the PHP code works (but it’s forward to new page), and test https://stackoverflow.com/a/7844043/1775888 (this can create Fancybox content own url in address bar) works too.

I can’t figure how to combine them?

I try this before: change href in PHP, click the subject $_GET[id] not isset then can’t get the query..

Any suggestion i’d really appreciate you taking the time.

PHP (index.php)

if(isset($_GET[id])){
    $id=mysql_real_escape_string($_GET["id"]);
    $sql="select * from $table where id='$id'";
    $query=mysql_query($sql) or die(mysql_error());
    while($list=mysql_fetch_array($query)){
            print"
<div class=\"contentwrap\" align=\"center\">
    <div class=\"content\">\"$list[content]\"</div>
</div>
    ";
        }
}
else{
    $sql="select * from $table order by id desc";
    $query=mysql_query($sql) or die(mysql_error());
    while($list=mysql_fetch_array($query)){
            print"
<div class=\"subjectwrap\" align=\"center\">
    <div class=\"subject\"><a href=\"index.php?id=$list[id]\">$list[subject]</a></div>
</div>
    ";
    }
}

jQuery (from https://stackoverflow.com/a/7844043/1775888)

function showfancybox(id) {
    switch(id) {
        case '#_name':

        $(id).show();

        $.fancybox({
            href: id,
            type:'inline',


            onClosed: function() {
                $(id).hide();
            }
        });
    break;
    }
}

showfancybox(location.hash);

$('a.flink').click(function(e){
    showfancybox($(this).attr('href')); 
});

edit:
I change the code let the $list[content] load and display:none.
Into index.php, get message: The requested content cannot be loaded. Please try again later.

<?php
$sql="select * from $table order by id desc";
    $query=mysql_query($sql) or die(mysql_error());
    while($list=mysql_fetch_array($query)){
        print"
    <div class=\"subjectwrap\">
        <div class=\"subject\"><a class=\"flink\" href=\"#$list[id]\">$list[subject]</a></div>
    </div>
    ";
    print"
<div class=\"atc\" id=\"$list[id]\">
    <div class=\"contentwrap\" align=\"center\">
        <div class=\"content\">\"$list[content]\"</div>
    </div>
</div>
    ";
    }
?> 

<script type="text/javascript">
$(function(){
function showfancybox(id) {
    switch(id) {
        case '<?php "#$list[id]" ?>':

        $(id).show();

        $.fancybox({
            href: id,
            type:'inline',

            onClosed: function() {
                $(id).hide();
            }
        });
    break;
    }
}

showfancybox(location.hash);

$('a.flink').click(function(e){
    showfancybox($(this).attr('href')); //make href to id
});         
});
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:44:00+00:00Added an answer on June 13, 2026 at 3:44 pm

    I`m sorry, but I do not what to answer to your question. Your code just seems to be all wrong.

    For example, do you even know why you have this line? –

    case '<?php "#$list[id]" ?>':

    What do you think it is for? How do you think it executes? Is that JavaScript piece inside the php loop? If yes, then you will get multiple functions having the same name.

    Besides this, if your goal is to open/close fancyBox based on the url hash, then I suggest using (soon to be released public) history helper, see this example – http://jsfiddle.net/FB7UW/show/light/ (http://jsfiddle.net/FB7UW/)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to create an if statement in PHP that prevents a single post
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.