how to make custom urls for different pages in a frame?

New to mod_rewrite? This is a good place to start.

how to make custom urls for different pages in a frame?

Postby Magic » Sat Jun 13, 2009 5:41 am




I have a question about the demo.rockettheme.com pages.

I want to create a similar setup for work I have done, does anyone know how to perform linking from a different page.

A sample on rockettheme would be that on any page (not the demo) it is linked like:

demo.rockettheme.com/?template=mobius-dark

Whatever I try, I can't get links to link, they all just go to the first in my list.

Anyone has a clue how to do this?



Piet,

The demo site is using seperate installs for each page and is displaying them in a wrapper. Are you just looking to achieve the same functionality or use the exact same method?
Hi,

I basically have a similar demo setup using the same techniques. The only thing I can't seem to get working is:

http://demo.rockettheme.com/?template=mobius-dark



What i mean is, when you are on any page on the internet and want to link to a certain template within the demo. RocketTheme uses that sort of links. I can't seem to get that working in my setup.

The query_string there is obviously something custom that was done by the RT Team. Have you written a similar 'redirect' script - or are you just trying to throw random variables at nothing in particular?



so this was a discussion at rocket.... and basically they say its custom... but is it custom mod rewrites....?
Magic
 
Posts: 7
Joined: Sat Jun 13, 2009 5:26 am

Postby richardk » Sat Jun 13, 2009 2:47 pm

I'm not certain what you are trying to do, but if you mean the /?template=mobius-dark you would not need mod_rewrite. You would need a server-side script, that would load a template based on the query string variable.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Magic » Sat Jun 13, 2009 6:34 pm

ok so this is not a rewrite? i know they are using many installs of joomla...

thanks for help
Magic
 
Posts: 7
Joined: Sat Jun 13, 2009 5:26 am

Postby richardk » Sun Jun 14, 2009 10:49 am

The site (rockettheme) uses JavaScript.
Code: Select all
   <script src="demo_chooser/scripts/mootools.js" type="text/javascript" charset="utf-8"></script>
   <script src="demo_chooser/scripts/demos.js" type="text/javascript" charset="utf-8"></script>


You could use a server-side language, for example PHP
Code: Select all
HTML for your template/head etc.
<?php

// A list of valid template IDs and their URL.
$page_id_to_url = array(
  'refraction' => 'http://demo.rockettheme.com/jun09/',
  'solarsentinel' => 'http://demo.rockettheme.com/may09/',
  'mynxx' => 'http://demo.rockettheme.com/apr09/',
);

if(isset($page_id_to_url[$_GET['template']]))
{
  echo '<iframe src ="' . $page_id_to_url[$_GET['template']]
     . '" width="100%" height="300">
  <p>Your browser does not support iframes.</p>
</iframe>';
}
else
{
  echo 'Invalid ID';
}
?>
HTML for your template/footer, etc.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Magic » Sun Jun 14, 2009 8:40 pm

here is another club doing same thing...

http://www.joomlajunkie.com/demo/

there source is easier to see whats going on::
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <title>Joomla Junkie Template Showcase</title>
   </head>
   <frameset rows="66,*" frameborder="no" border="0" framespacing="0">
      <frame src="http://www.joomlajunkie.com/demo/top_nav.php?template=dark-rational" name="top_nav" scrolling="No" noresize="noresize" id="top_nav" title="top_nav" />
      <frame src="http://www.joomlajunkie.com/demo/commercial/dark-rational" name="mainframe" id="mainframe" title="mainframe" />

   </frameset>
   <noframes>
      <body><!-- Begin W3Counter Tracking Code -->
         <script type="text/javascript" src="http://www.w3counter.com/tracker.js"></script>
         <script type="text/javascript">w3counter(3544);</script>
         <noscript>
            <div>
               <a href="http://www.w3counter.com"><img src="http://www.w3counter.com/tracker.php?id=3544" style="border: 0" alt="W3Counter Web Stats" /></a>
            </div>
         </noscript>
         <!-- End W3Counter Tracking Code-->
         <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
         <script type="text/javascript">_uacct = "UA-174147-5";urchinTracker();</script>
      </body>
   </noframes>
</html>


and a call to a specific template is

Code: Select all
http://www.joomlajunkie.com/demo/index.php?template=blogger-lite


so i have a nav.php and main.php which make up the total demo i want to send people to...

were would i put the php code? because i searched the page with the demo link and i didn't see any code like that....

i truly appreciate your help... nobody else anywhere has a clue...
Magic
 
Posts: 7
Joined: Sat Jun 13, 2009 5:26 am

Postby richardk » Mon Jun 15, 2009 11:54 am

were would i put the php code? because i searched the page with the demo link and i didn't see any code like that....

PHP runs on the server and is never sent to the browser.

You put the frameset in an index.php file with the PHP, eg.
Code: Select all
<?php

// A list of valid template IDs and their URL.
$page_id_to_url = array(
//'DEMO_ID' => 'DEMO_URL',
  'refraction' => 'http://demo.rockettheme.com/jun09/',
  'solarsentinel' => 'http://demo.rockettheme.com/may09/',
  'mynxx' => 'http://demo.rockettheme.com/apr09/',
);

if(!isset($page_id_to_url[$_GET['template']]))
{
?>
A HTML page for when the demo is not found.
<?php
}

$demo_id = $_GET['template'];
$demo_url = $page_id_to_url[$_GET['template']];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <title>Joomla Junkie Template Showcase</title>
   </head>
   <frameset rows="66,*" frameborder="no" border="0" framespacing="0">
      <frame src="/nav.php?template=<?php echo $demo_id; ?>" name="top_nav" scrolling="No" noresize="noresize" id="top_nav" title="top_nav" />
      <frame src="<?php echo $demo_url; ?>" name="mainframe" id="mainframe" title="mainframe" />
   </frameset>
   <noframes>
      <p>Your browser does not support frames.</p>
   </noframes>
</html>

and in nav.php you would have the navigation.

Use
Code: Select all
<?php echo $demo_id; ?>

in your HTML where you want the demo ID.

Use
Code: Select all
<?php echo $demo_url; ?>

in your HTML where you want the demo URL.

You must update
Code: Select all
// A list of valid template IDs and their URL.
$page_id_to_url = array(
//'DEMO_ID' => 'DEMO_URL',
  'refraction' => 'http://demo.rockettheme.com/jun09/',
  'solarsentinel' => 'http://demo.rockettheme.com/may09/',
  'mynxx' => 'http://demo.rockettheme.com/apr09/',
);

to include your demo IDs and URLs.

If your nav.php does not change for each demo. You could use on file (index.php) and an <iframe>.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Magic » Mon Jun 15, 2009 1:34 pm

this is looking good... last element left...

every time people click on one of the links in the regular part of site to go to demo...

i would like the drop down menu in the nav.php

to reflect what demo page they are viewing...

and with that this would be a perfect script.. :D
Magic
 
Posts: 7
Joined: Sat Jun 13, 2009 5:26 am

Postby richardk » Mon Jun 15, 2009 5:47 pm

You might be able to do it with JavaScript, but i'm not sure/don't know how. You might be able to set an onChange event on the demo frame.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Magic » Mon Jun 15, 2009 7:08 pm

well..

looked into that not sure how to code that...

a crude solutions is to make different nav.php for each choice and hard code the chosen template as selected....

its a solution not the best.... i know.. i wish i could create code...

i am a painter turned to computer graphics... acting as a web developer to continue with my projects....

thanks for the help... you will probably get alot of hits because of this thread...lol
Magic
 
Posts: 7
Joined: Sat Jun 13, 2009 5:26 am

Postby Magic » Mon Jun 15, 2009 7:13 pm

onchange="window.open(this.options[this.selectedIndex].value, 'nameOfTargetFrame')"

just found this... not sure if this was what you meant.. or how to use it
Magic
 
Posts: 7
Joined: Sat Jun 13, 2009 5:26 am

Next

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 110 guests

cron