Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How can I create a text output from an excel spreadsheet with html syntax? I'm trying to create a html page menu with php. But I need some kind of easy creation of the menu, so that in case of the developer's absence, the menu can be altered without any problem. For this I'm thinking of using echo in php to output the menu contents in the <header> div...

My Excel file contains XML maps to generate an XML currently that's loaded via javascript on page for dynamic content. I had added a menu to be generated too via javascript. But google doesn't index javascript enabled content (learnt this after reading about google indexer and javascript today). So I'm thinking of generating a PHP file with HTML syntax output via VBA in Excel. I have Office / Excel 2010.

My Excel Spreadsheet looks like this:

Excel Spreadsheet

Link to excel spreadsheet: https://dl.dropboxusercontent.com/u/27854284/Stuff/Online/www_projects/00Products.xlsx

Here's the output I require as per the spreadsheet:

<li class="w-nav-item level_1 has_sublevel">
    <a class="w-nav-anchor level_1" href="javascript:void(0);">
        <span class="w-nav-icon"><i class="fa fa-files-o"></i></span>
        <span class="w-nav-title">Products</span>
        <span class="w-nav-arrow"></span>
    </a>
    <!-- level 2 -->
    <ul class="w-nav-list level_2">
        <li class="w-nav-item level_2 has_sublevel">
            <a class="w-nav-anchor level_2" href="c_1_category_a.html">
                <span class="w-nav-title">Category A</span>
                <span class="w-nav-arrow"></span>
            </a>
            <!-- level 3 -->
            <ul class="w-nav-list level_3">
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="1_product_1.html">
                        <span class="w-nav-title">Product 1</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="1_product_2.html">
                        <span class="w-nav-title">Product 2</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="1_product_3.html">
                        <span class="w-nav-title">Product 3</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
            </ul>
        </li>
        <li class="w-nav-item level_2 has_sublevel">
            <a class="w-nav-anchor level_2" href="c_2_category_b.html">
                <span class="w-nav-title">Category B</span>
                <span class="w-nav-arrow"></span>
            </a>
            <!-- level 3 -->
            <ul class="w-nav-list level_3">
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="2_product_4.html">
                        <span class="w-nav-title">Product 4</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="2_product_5.html">
                        <span class="w-nav-title">Product 5</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="2_product_6.html">
                        <span class="w-nav-title">Product 6</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="2_product_7.html">
                        <span class="w-nav-title">Product 7</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
                <li class="w-nav-item level_3">
                    <a class="w-nav-anchor level_3" href="2_product_8.html">
                        <span class="w-nav-title">Product 8</span>
                        <span class="w-nav-arrow"></span>
                    </a>
                </li>
            </ul>
        </li>
        <!---Menu to be created by XML --->
        <!---------------END product with sublevel------------------>
    </ul>
</li>

Here's a jsfiddle on how currently my menu is generated: jsfiddle I don't require this method (js) now, cause I've recently found out that google doesn't index javascript generated content... (the jsfiddle does not work due to external xml data source, but the javascript is all there that uses only jQuery and html+css to generate the menu via xml)

Please could anyone help? Thanks!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.