Enhancement Suggestion for MSU to handle DIFFERENT "Themes"

Explain your request with as much detail as possible.
Topher
Posts: 17
Joined: Sun Apr 12, 2009 10:03 pm

Enhancement Suggestion for MSU to handle DIFFERENT "Themes"

Postby Topher » Mon May 13, 2013 9:47 am

Suggestion for MSU:

PREAMBLE:

In this day and digital age, MOBILE devices make up about 50% if not more, of the web traffic on the internet. Sites that offer a Mobile version of their main website is growing by leaps and bounds.

Yes, many sites use a Responsive template, but many existing site applications (ie, Zen Cart, etc.) DO NOT and ARE NOT responsive and site owners turn to 3rd party Mobile solutions, plugins and mods to bridge the gap so they can have a Normal website and a Mobile version too.

For Inveo's MSU product to meet the needs and bridge the gap between Old and New Technology and Developing Trends, I offer the following suggestion. If I knew more about HTACCESS files and so forth, I could do it myself quickly and simply. But I don't, but I do have an idea that SHOULD WORK EASILY.

I offer this because I just came across it in my own website. I am using MSU to great satisfaction on my Zen Cart powered website, but to meet the needs of the Mobile devices now so prevalent, I added a Mobile mod/plugin that can present my website on Mobile devices just fine. But I just noticed that while all of my URL's on the normal website are SEO friendly, all of my Mobile URL's are still the old ugly SEO UNFRIENDLY type.

Why? Because MSU will ONLY affect changes and rewrites for "index.php". But my Mobile mod/plugin uses instead "mobile.php" (replacing "index.php") and it never gets rewritten by MSU.

So what to do? My suggestion is this:

SUGGESTION:

Add a section in the file msu_tweak.ini to edit/add/change the default(s) for the main "file" such as 'index.php' so you can edit the default and/or add others. For example:

Code: Select all

****** add to msu_tweak.ini file ******

; @name: index.php and alternates
; @description: allow to change or switch from 'index.php' to an alternate like 'mobile.php'
; @var: string
; @default: "index" or "index.php", and comma-delimited ',' if specifying more than one (ie, "index,mobile,whatever")
; @range: any character allowed for filenames and is Case-Sensitive
; @recommended: "index" (the '.php' is assumed, but can be added if desired, and whitespaces are ignored: "index.php, mobile.php, whatever.php")
; @.htaccess: re-generation is required

index_alternates = "index"  ;; or edit as necessary, such as: "index, mobile" or "index, mobile, whatever"

****** end add to msu_tweak.ini file ******


Now in the heart and core of MSU's logic to create the HTACCESS file, it should be possible for .htaccess to check for whether the URL/URI is for "index.php" or for "mobile.php" (as an example) and then use a number of VAR's that is set to either "index" and/or "index.php" or to "mobile" and/or "mobile.php" and using these VAR's or wildcards, to generate the HTACCESS file that will accomodate and rewrite as needed whether it's using "index.php" or "mobile.php". Either way, the URLs/URIs are SEO Friendly no matter if on the Normal website or the Mobile version of the website (via website template switching).

If this could be done (and I do think it could be very easily), it would be a GREAT Enhancement and should drive your sales even higher!

What do you think? Is it possible?

Topher

inveo
Inveo Support
Posts: 1285
Joined: Sat Feb 02, 2008 12:07 pm
Contact:

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby inveo » Wed May 15, 2013 7:35 am

It actually should be possible to initialize MSU inside mobile.php file. Please post us the content of this file and we will take a look.

On the other hand mobile web site should not be allowed to index so there is no point to transform URLs to SEO formats.

Topher
Posts: 17
Joined: Sun Apr 12, 2009 10:03 pm

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby Topher » Wed May 15, 2013 12:04 pm

As you requested, the "mobile.php" file contents is below. Just as a side note, the file sets a session var to determine whether to use index.php or mobile.php...

Here's the mobile.php file:

Code: Select all

/**
 * Load common library stuff
 */
  require('includes/application_top.php');

  if (isset($_SESSION['mobile_tpl'])) {
    $_SESSION['mobile_tpl'] = 1;
  }

  $language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
  $directory_array = $template->get_template_part($code_page_directory, '/^header_php/');
  foreach ($directory_array as $value) {
/**
 * We now load header code for a given page.
 * Page code is stored in includes/modules/pages/PAGE_NAME/directory
 * 'header_php.php' files in that directory are loaded now.
 */
    require($code_page_directory . '/' . $value);
  }
 
 
/**
 * We now load the html_header.php file. This file contains code that would appear within the HTML <head></head> code
 * it is overridable on a template and page basis.
 * In that a custom template can define its own common/html_header.php file
 */
  require($template->get_template_dir('html_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/html_header.php');
/**
 * Define Template Variables picked up from includes/main_template_vars.php unless a file exists in the
 * includes/pages/{page_name}/directory to overide. Allowing different pages to have different overall
 * templates.
 */
  require($template->get_template_dir('main_template_vars.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/main_template_vars.php');
/**
 * Read the "on_load" scripts for the individual page, and from the site-wide template settings
 * NOTE: on_load_*.js files must contain just the raw code to be inserted in the <body> tag in the on_load="" parameter.
 * Looking in "/shop/includes/modules/pages" for files named "on_load_*.js"
 */
  $directory_array = $template->get_template_part(DIR_WS_MODULES . 'pages/' . $current_page_base, '/^on_load_/', '.js');
  foreach ($directory_array as $value) {
    $onload_file = DIR_WS_MODULES . 'pages/' . $current_page_base . '/' . $value;
    $read_contents='';
    $lines = @file($onload_file);
    foreach($lines as $line) {
      $read_contents .= $line;
    }
  $za_onload_array[] = $read_contents;
  }
/**
 * now read "includes/templates/TEMPLATE/jscript/on_load/on_load_*.js", which would be site-wide settings
 */
  $directory_array=array();
  $tpl_dir=$template->get_template_dir('.js', DIR_WS_TEMPLATE, 'jscript/on_load', 'jscript/on_load_');
  $directory_array = $template->get_template_part($tpl_dir ,'/^on_load_/', '.js');
  foreach ($directory_array as $value) {
    $onload_file = $tpl_dir . '/' . $value;
    $read_contents='';
    $lines = @file($onload_file);
    foreach($lines as $line) {
      $read_contents .= $line;
    }
    $za_onload_array[] = $read_contents;
  }

  // set $zc_first_field for backwards compatibility with previous version usage of this var
  if (isset($zc_first_field) && $zc_first_field !='') $za_onload_array[] = $zc_first_field;

  $zv_onload = "";
  if (isset($za_onload_array) && count($za_onload_array)>0) $zv_onload=implode(';',$za_onload_array);

  //ensure we have just one ';' between each, and at the end
  $zv_onload = str_replace(';;',';',$zv_onload.';');

  // ensure that a blank list is truly blank and thus ignored.
  if (trim($zv_onload) == ';') $zv_onload='';
/**
 * Define the template that will govern the overall page layout, can be done on a page by page basis
 * or using a default template. The default template installed will be a standard 3 column layout. This
 * template also loads the page body code based on the variable $body_code.
 */
  require($template->get_template_dir('tpl_main_page.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_main_page.php');
?>
</html>
<?php
/**
 * Load general code run before page closes
 */
?>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Thanks for taking a look and I'm *really* hoping for an easy solution that benefits everyone.

Topher

Topher
Posts: 17
Joined: Sun Apr 12, 2009 10:03 pm

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby Topher » Wed May 15, 2013 12:08 pm

Oh, I forgot to add that the session var (mobile_tpl) is also used in other files to ensure (I'm guessing) that it properly triggers/maintains state of whether it's to be in mobile or normal mode (ie, which template or theme to be used).

Topher

Topher
Posts: 17
Joined: Sun Apr 12, 2009 10:03 pm

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby Topher » Wed May 15, 2013 12:16 pm

Hey, I'm on a roll... That is, for forgetting to include helpful stuff... lol

To checkout what I mean, you can go to my site (still under dev and is a re-do of a previous site I had, btw):

http://www.Cash4Laughs.com/shop/ (if you don't add the /shop/ at the end, see what happens!)

There is a "MOBILE" link at the top and bottom to switch between Normal and Mobile mode and you will see the difference in the URL's between the two "templates"...

Topher

inveo
Inveo Support
Posts: 1285
Joined: Sat Feb 02, 2008 12:07 pm
Contact:

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby inveo » Thu May 16, 2013 6:48 am

We found why URLs are not transformed to SEO formats in mobile.php and we will include a fix in upcoming update.

Topher
Posts: 17
Joined: Sun Apr 12, 2009 10:03 pm

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby Topher » Fri May 17, 2013 8:02 pm

~J~,

That's Great News! Glad I could help along MSU to be an even better product. Hey, I've paid full price for it 3 different times since 2009 - IT IS A MUST HAVE for Zen Cart.

I'm looking forward to the updated version that fixes the glitch I found. Hope it's out soon!

But you never mentioned what the problem was... Curious to know, if you're willing to say what it is/was.

Topher

Topher
Posts: 17
Joined: Sun Apr 12, 2009 10:03 pm

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby Topher » Sat Jun 08, 2013 12:48 pm

~J~

When do you anticipate the next update release that will include the fix for "mobile.php"? I'm hoping to see it in the next 30 to 60 days as that is when I hope to have my website (and mobile version) ready for going live...

If you need someone to beta the fix, just let me know. I'd be happy to do it and report results.

Thanks!

Topher

Topher
Posts: 17
Joined: Sun Apr 12, 2009 10:03 pm

Re: Enhancement Suggestion for MSU to handle DIFFERENT "Them

Postby Topher » Tue Jul 09, 2013 10:42 am

~J~,

It's been about three months since I first posted the suggestion and you said it will be addressed in the next update release.

Any idea when that will be? I hope the update is out soon as I'm about to turn my new site on and having SEO ready mobile pages is kind of important. :D

Thanks!

Topher