0
votes

Situation:

ASP shopping cart site without any blog facility. Helping out a friend, I installed Wordpress into its own folder to sit with the ASP shopping cart and designed the WP theme to mirror the ASP cart style. Adding the blog to the ASP includes menu for the shopping cart. Now I am looking at including the ASP menu within the WordPress blog.

Issue: The ASP 'includes' menu file generates some drop down options on the fly via its CMS - so copying the generated html into the Wordpress Menu file is not the answer. Including the ASP file into the header.php file of Wordpress is the right way to go about it in my situation.

ASP File:

~/inc/topmenu.asp

Code added into WP Theme header.php:

 <!-- #site-navigation -->
    <?php 
    ini_set (user_agent, "IE");
    ini_set (default_socket_timeout, "3");
    error_reporting(0);
    $theurl="http://www.perfectlyperfectpresents.com/inc/topmenu.asp";
    $filestring=file_get_contents("$theurl") ;        
    echo "$filestring";
    ?>
 <!-- #site-navigation -->

The reason I have approached it via an "includes" style inside the PHP file is that it's very important for the Google to be able to follow the many URL's and indexed. Hence, not considering the iFrame approach.

My Solution above works within the blog as expected. BUT Is there a more elegant way of achieving the same which works faster within the server ?

1
Retrieve the content of the topmenu with jquery ajax and inject it would be more elegant in my opinion - Paul
Thanks for the feedback Paul, and how would that work with Google/Bing being able to index all of the links within the topmenu ? - Martin Sansone - MiOEE
If you want the data to be indexed then choose the solution provided by yourself. Search engines do not run javascript, so you have to include the content on the server. I'm not familiar with file_get_contents (strange name by the way if quering a url) but be aware of caching issues. An alternative solution would be that the ASP would create a php/html file on disk. But then you would need to trigger the ASP to run periodically (after every content change of the menu). Nhaaaaa.... probably just stick with your first solution. - Paul
"file_get_contents" is a php method which loads entire files into a string. us3.php.net/file_get_contents A handy call in various situations. - Martin Sansone - MiOEE
The way you did it is the way I would have approached it. Your PHP code either needs to execute the same queries against the CMS as it's ASP counterpart, OR get the HTML after it's been processed by the ASP engine. What you did accomplishes that using server resources. I'd advise that over the Ajax/JavaScript approach because all of that processing is shifted to the client and then you'll have the obvious issues with the search engine indexing. - Dave Mroz

1 Answers

0
votes

In agreement with Dave Mroz and other programmers I have spoken to - The solution I used above appears to be the best way of embedding an existing and dynamic ASP 'includes' file into WordPress in combining a WP blog into a standard ASP coded website. So I am marking it as answered.