Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    856
    Plugin Contributions
    0

    Default Defining with an * or Wild Card

    Hi all,
    Getting some custom defines worked out here and need a bit of guidance. Here is what I would like to do:

    Code:
    define('META_TAG_TITLE_/WOZ/TAG/*', 'Here is the Meta Title Text!');
    So that no matter what "tag" is being viewed this is the title that will be used. Apparently the * is not what I need to use here.

    Thanks in Advance,
    John

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Defining with an * or Wild Card

    You need to have essentially a separate define statement for each tag. Are you saying you want to have the same meta title for all of them?

    You can either just make a list of all of the defines for all cases, or if you have a variable/array that holds all of the tags you are going to want, you can loop through the array and substitute the current value into the define.
    PHP Code:
    foreach ($tag_array as $tag_value){
      
    define('META_TAG_TITLE_/WOZ/TAG/' $tag_value'Here is the Meta Title Text!');

    This will automatically account for new tags without having to add another define.

  3. #3
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    856
    Plugin Contributions
    0

    Default Re: Defining with an * or Wild Card

    Hi Glenn,
    Thanks for the quick help!

    This is not exactly what I'm looking for here. I have written / compiled custom code that allows us to use custom meta info for every page, post, category. . . for WOZ.

    This is being done with an overridden html_header.php, languages/meta_tags.php and modules meta_tags.php.


    This is how I'm determining what wp page we're on
    Code:
    require(DIR_WS_LANGUAGES . 'english/MyTemp/wp_meta_tags.php'); 
    function curPageURL() { 
     $pageURL = $_SERVER["REQUEST_URI"];
     return $pageURL;
      } 
        $wpPageBase = curPageURL();
       // echo strtoupper($wpPageBase);
    
    // if per-page metatags overrides have been defined, use those, otherwise use usual defaults:
    
      if (defined('META_TAG_TITLE_' . strtoupper($wpPageBase))) define('META_TAG_TITLE', constant('META_TAG_TITLE_' . strtoupper($wpPageBase)));
      
       if (defined('META_TAG_KEYWORDS_' . strtoupper($wpPageBase))) define('META_TAG_KEYWORDS', constant('META_TAG_KEYWORDS_' . strtoupper($wpPageBase)));
      
      if (defined('META_TAG_DESCRIPTION_' . strtoupper($wpPageBase))) define('META_TAG_DESCRIPTION', constant('META_TAG_DESCRIPTION_' . strtoupper($wpPageBase)));
    the entire address after http://www.mydomain.com/ is being stored in $wpPageBase. so if I echo this out on screen on a "tags" page I would see /WORDPRESS/TAG/THE-TAG-NAME/

    So if we can say something like define('META_TAG_TITLE_/WORDPRESS/TAG/*

    and have that title define used for any /WORDPRESS/TAG/ this would complete the customization.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Defining with an * or Wild Card

    You will have to get the value of the tag name into the define - a * is just not going to work.

    If you have the address including the tag name stored in $wpPageBase, you can use PHP string functions to extract the part you want, put it into a variable, and use that variable in the define (just llike the example above, without the foreach loop).
    Gotta run, can't do more now.

  5. #5
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    856
    Plugin Contributions
    0

    Default Re: Defining with an * or Wild Card

    Thanks again Glenn!

    I can not believe how well my php is coming along. Thank you for the pointer.

    Here is what I have concocted. Of course there is a set of matching defines in the language file!

    PHP Code:
    <?php
    /**
     * meta_tags module
     *
     * @package modules
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: meta_tags.php 6863 2007-08-27 16:06:25Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
    // This should be first line of the script:
    require(DIR_WS_LANGUAGES 'english/MyTemp/wp_meta_tags.php'); 
    function 
    curPageURL() { 
     
    $pageURL $_SERVER["REQUEST_URI"];
     return 
    $pageURL;
      } 
        
    $wpPageBase curPageURL();
        
    $wpTag substr($wpPageBase,0,15);

        
    //echo strtoupper($wpTag);

    // if per-page metatags overrides have been defined, use those, otherwise use usual defaults:
    if (strtoupper($wpTag) == '/WORDPRESS/TAG/') {
    if (
    defined('META_TAG_TITLE_/WORDPRESS/TAG/')) define('META_TAG_TITLE'constant('META_TAG_TITLE_/WORDPRESS/TAG/'));
    if (
    defined('META_TAG_KEYWORDS_/WORDPRESS/TAG/')) define('META_TAG_KEYWORDS'constant('META_TAG_TITLE_/WORDPRESS/TAG/'));
    if (
    defined('META_TAG_DESCRIPTION_/WORDPRESS/TAG/')) define('META_TAG_DESCRIPTION'constant('META_TAG_TITLE_/WORDPRESS/TAG/'));
      } else {
      if (
    defined('META_TAG_TITLE_' strtoupper($wpPageBase))) define('META_TAG_TITLE'constant('META_TAG_TITLE_' strtoupper($wpPageBase)));
      
       if (
    defined('META_TAG_KEYWORDS_' strtoupper($wpPageBase))) define('META_TAG_KEYWORDS'constant('META_TAG_KEYWORDS_' strtoupper($wpPageBase)));
      
      if (
    defined('META_TAG_DESCRIPTION_' strtoupper($wpPageBase))) define('META_TAG_DESCRIPTION'constant('META_TAG_DESCRIPTION_' strtoupper($wpPageBase)));
      };
    Coder For Hire Here!! Kidding LOL

    Thanks again Glenn,
    John

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Defining with an * or Wild Card

    Good for you! Glad you have it working.

 

 

Similar Threads

  1. Need help with defining attributes directly in mySQL
    By nasdaqphil in forum Customization from the Admin
    Replies: 6
    Last Post: 29 Nov 2010, 12:11 AM
  2. Bot Injection Attempts Gone Wild
    By skipwater in forum General Questions
    Replies: 2
    Last Post: 27 Aug 2008, 01:56 AM
  3. defining images in zencart with a class tag
    By batteryman in forum General Questions
    Replies: 3
    Last Post: 20 Dec 2007, 09:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg