カテゴリの XML マップ ファイルを作成しています。私が考えている2つのオプションを考えると、正しいアプローチはどうなるのだろうと思っていました。
私の主な問題は、XML ファイルを読み取る必要がある可能性のある php コードの速度/効率です。だからここに私の最初のアプローチがあります
<?xml version="1.0" encoding="utf-8"?>
<category-map lang="en_US" reader="Candor Framework">
<for-her url="/content/syl/tags/for-her">
<women-tops url="/content/syl/category/15/women-tops">
<women-longsleeve-tops url="/content/syl/tags/women-longsleeve-tops">Longsleeve Tops</women-longsleeve-tops>
<women-shortsleeve-tops url="/content/syl/tags/women-shortsleeve-tops">Shortsleeve Tops</women-shortsleeve-tops>
</women-tops>
<women-gowns url="/content/syl/category/18/women-gowns/">
<short-gowns url="/content/syl/tags/short-gowns">Short Gowns</short-gowns>
<evening-gowns url="/content/syl/tags/evening-gowns">Evening Gowns</evening-gowns>
</women-gowns>
<women-shoes url="/content/syl/category/19/women-shoes/">
<women-highheel-shoes url="/content/syl/tags/women-highheel-shoes">High Heel Shoes</women-highheel-shoes>
<women-wedge-shoes url="/content/syl/tags/women-wedge-shoes">Wedge Shoes</women-wedge-shoes>
</women-shoes>
</for-her>
<for-him url="/content/syl/tags/for-him">
<men-shirt url="/content/syl/category/20/men-shirt">
<men-lonsleeve-shirt url="/content/syl/tags/men-longsleeve-shirt">Longsleeve Shirt</women-longsleeve-tops>
</men-shirt>
</for-him>
</category-map>
このアプローチでは、すべての XML タグに一意の名前が付けられます。次に、この 2 番目のアプローチと比較してください。
<?xml version="1.0" encoding="utf-8"?>
<category-map lang="en_US" reader="Candor Framework">
<target name="for-her" url="/content/syl/tags/for-her">
<category name="women-tops" url="/content/syl/category/15/women-tops">
<tag name="women-longsleeve-tops" url="/content/syl/tags/women-longsleeve-tops">Longsleeve Tops</tag>
<tag name="women-shortsleeve-tops" url="/content/syl/tags/women-shortsleeve-tops">Shortsleeve Tops</tag>
</category>
<category name="women-gowns" url="/content/syl/category/18/women-gowns/">
<tag name="short-gowns" url="/content/syl/tags/short-gowns">Short Gowns</tag>
<tag name="evening-gowns" url="/content/syl/tags/evening-gowns">Evening Gowns</tag>
</category>
<category name="women-shoes" url="/content/syl/category/19/women-shoes/">
<tag name="women-highheel-shoes" url="/content/syl/tags/women-highheel-shoes">High Heel Shoes</tag>
<tag name="women-wedge-shoes" url="/content/syl/tags/women-wedge-shoes">Wedge Shoes</tag>
</category>
</target>
<target name="for-him" url="/content/syl/tags/for-him">
<category name="men-shirt" url="/content/syl/category/20/men-shirt">
<tag name="men-lonsleeve-shirt" url="/content/syl/tags/men-longsleeve-shirt">Longsleeve Shirt</tag>
</category>
</target>
</category-map>
これは XML ファイルの短いバージョンです。全体の内容はかなりのものです。これらの設計アプローチのどちらが高速ですか?、ループと条件が少なくて済むのはどれですか? どちらに従うことをお勧めしますか、またその理由は何ですか?
とても有難い!