Announcement

Collapse
No announcement yet.

blank form selection

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • blank form selection

    Hey guys
    been having some minor issues with the new V8, but I think I will come to those in another thread.

    I have a problem with a DB selection made using a blank form, menu and language selection.

    So I will explain and hope somebody can help or point in the right direction because its drivings me nuts

    The menu has language selection, on selection of language it changes the menu lang, so I have a blank form create and the below code. Whats meant to happen is on lang change the select is to also change the page content from db.

    What is actually happening thou, which is very weird...... On selection of the language the db doesn't change. on debug and echo of variables I see that when I try and select from language it changes the region. So I flip my selection to select on region. When I do this the menu start changing the language and no longer the region........
    So in short it doesn't work......

    Maybe somebody can help, I have adjusted the code and tried to select on the lang/region var and it doesn't select anything anymore, ie. blank page. as below I get a select working ie. only in English so the first if statement.

    Code:
    // Get User language on drop menu
    $page_region = sc_get_regional();
    $page_language = sc_get_language(); // If the redirect to language the menu starts to change the region instead....
    
    // Redirection
    if ($page_region = 'en_us')
    {
    // Set Page of index_page
    $page = '5';
    }
    elseif ($page_region = 'pt_pt')
    {
    $page = '6';
    }
    elseif ($page_region = 'es_es')
    {
    $page = '7';
    }
    elseif ($page_region = 'de_de')
    {
    $page = '8';
    }
    
    // Get Page Content
    $get_content = 'SELECT pageID, page_actual, page_title, page_content, page_desc, page_lang'
       . ' FROM pages'
       . ' WHERE pageID = ' . $page;
    sc_lookup(rs, $get_content);
    
    {title} = {rs[0][1]};
    {content} = {rs[0][2]};
    {desc} = {rs[0][3]};
    {lang} = $page_language;
    {region} = $page_region;
    // HTML CSS Styling
    print ("
     <style type='text/css'>
      body {background-repeat: repeat;background-image: url(../_lib/img/grey_bg.jpg);}
      h1 {font-family: \"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif;}
      p {font-family: \"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif; }
      p.txt {font-family: \"Lucida Sans Unicode\", \"Lucida Grande\", sans-serif;}
      ul {  }
      ul li { list-style: none;padding-left:20px;background-repeat: repeat;background-image: url(../_lib/img/grey_bg.jpg); }
      .box {padding:20px; }
      }
    
     </style>
    ");
    
    // Page Content
    echo "
    <div class=\"box\">
    <h1>language:{lang}, Region:{region} - {title}</h1>
    {content}
    </div>
    ";
    Thanks in advance for any help!

  • #2
    wanted to share how I solved this as I had no bright ideas from anybody on a solution, thankfully I came up with one which is working a treat!
    For some reason the language is actually set correctly like this, funny the other way didn't work, but hey its working now

    I am using this for a small CMS for the front end of my application.

    // Get User language on drop menu
    $usr_lang = sc_get_language();
    $page = 'index_page';

    // Get Page Content
    $get_content = "SELECT pageID, page_actual, page_title, page_content, page_desc, page_lang"
    . " FROM pages"
    . " WHERE page_actual = '" . $page . "' AND page_lang = '" . $usr_lang . "'";
    sc_lookup(rs, $get_content);

    if (isset({rs[0][0]})) // Row found
    {
    {title} = {rs[0][1]};
    {content} = {rs[0][2]};
    {desc} = {rs[0][3]};
    }
    else // No row found
    {
    {title} = 'ERROR';
    {content} = 'ERROR';
    }

    Comment

    Working...
    X