具有垂直选项卡内容的Php阵列

时间:2014-07-15 00:35:16

标签: php html css arrays

如果没有加载内容,我正试图找出如何隐藏我的一个侧面导航按钮

(每个部分的身体部位每个部分1-4个标签不同,目前有三个标签加载)

我正在使用PHP数组加载网页此部分的所有内容。

以下是我的一些代码示例(尽可能地删除) Js Fiddle

我的第一个想法是做和“if”和“else”声明,我从另一个例子尝试过这里,但我仍然需要找出一种方法来关闭按钮的css只是不确定如何解决这个问题!

任何帮助表示赞赏,请注意我是php的新手!

此处还有一个链接,说明部分内容如何加载数组只是为了直观地帮助:

http://imgur.com/WRkXzv3 Screenshot of Array Content

这是我的数组的片段,它被包含在php文件中

// #Hips#
$injuries['Hips'] = array(
    "BodyPartLink" => "Hips",
    "TitlePage" => "Hips Injuries & Education",
    "IntroTxt" => "Hips Intro Text Here",
    "SectionTab1" => "",
    "SectionTab2" => "Hip Condition #2",
    "SectionTab3" => "Hip Condition #3",
    "ContentSection" => "Hips Dummy Text Here For Large Text Section"
);

// #Hips  Section Contents TAB 1 #
$Tab1SectionContents['Hips'] = array(
    "Definition" => "<span class='edu-sub-category-txt-bold'>Definition:</span>Lower Back Information coming soon! ",
    "Function" => "<span class='edu-sub-category-txt-bold'>Function:</span>Information coming soon!",
    "Mechanism" => "Mechanism of Injury ",
    "MechanismTxt" => "Information coming soon!",
    "Sign-Symptoms" => "Signs & Symptoms ",
    "Sign-SymptomsTxt" => "Information coming soon!",
    "Etiology" => "Etiology ",
    "EtiologyTxt" => "Information coming soon!",
    "Pero-Treatment" => "Pero Treatment ",
    "Pero-TreatmentTxt" => "Information coming soon!",
    "Other-Treatment" => "Other Treatment ",
    "Other-TreatmentTxt" => "Information coming soon!"
);

// #Hips  Section Contents TAB 2 #
$Tab2SectionContents['Hips'] = array(
    "Definition" => "<span class='edu-sub-category-txt-bold'>Definition:</span>Lower Back -- Phasellus erat sem, molestie vitae turpis et, vehicula facilisis dolor. Mauris ut iaculis eros,     in auctor nibh. In eget nisl tristique elit varius semper. ",
    "Function" => "<span class='edu-sub-category-txt-bold'>Function:</span> Function -- molestie vitae turpis et, vehicula facilisis dolor. Mauris ut iaculis eros,",
    "Mechanism" => "Mechanism of Injury ",
    "MechanismTxt" => "Text for Mechanism",
    "Sign-Symptoms" => "Signs & Symptoms ",
    "Sign-SymptomsTxt" => "Signs & Symptoms ",
    "Etiology" => "Etiology ",
    "EtiologyTxt" => "Etiology ",
    "Pero-Treatment" => "Pero Treatment ",
    "Pero-TreatmentTxt" => "Pero Treatment ",
    "Other-Treatment" => "Other Treatment ",
    "Other-TreatmentTxt" => "Other Treatment "
);

// #Hips  Section Contents TAB 3 #
$Tab3SectionContents['Hips'] = array(
    "Definition" => "<span class='edu-sub-category-txt-bold'>Definition:</span>Lower Back -- Phasellus erat sem, molestie vitae turpis et, vehicula facilisis dolor. Mauris ut iaculis eros,     in auctor nibh. In eget nisl tristique elit varius semper. ",
    "Function" => "<span class='edu-sub-category-txt-bold'>Function:</span> Function -- molestie vitae turpis et, vehicula facilisis dolor. Mauris ut iaculis eros,",
    "Mechanism" => "Mechanism of Injury ",
    "MechanismTxt" => "Text for Mechanism",
    "Sign-Symptoms" => "Signs & Symptoms ",
    "Sign-SymptomsTxt" => "Signs & Symptoms ",
    "Etiology" => "Etiology ",
    "EtiologyTxt" => "Etiology ",
    "Pero-Treatment" => "Pero Treatment ",
    "Pero-TreatmentTxt" => "Pero Treatment ",
    "Other-Treatment" => "Other Treatment ",
    "Other-TreatmentTxt" => "Other Treatment "
); // ## END HIPS ##

1 个答案:

答案 0 :(得分:0)

你可以用Javascript来做。检查与您的标签相关联的div是否为空 - 因此没有数据/内容通过。如果它是空的,请将其删除。

$(function(){
    if (!$('.element').html()){
        // If the element is empty, remove it
        $('.element').remove();
    }
});