Using URL ?page=???? in if then statement

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
Jessica

Using URL ?page=???? in if then statement

Post by Jessica »

Hi All,

First off I want to say hi and how much I am totally loving CMSMS!!!! This thing really rocks and I can't wait to use it for my clients.

Now on to my question: I am trying to hide the {title} on the home page

{if $page = "Home"}
                      nothing
               {else}
                     {title}
          {/if}


Now I notice that CMS caches the variable "Home" - (I found this out by using {$smarty.get.page} ) -
How do I get around this??

Thanks for your help in advance - and again - I LOVE CMSMS!!!!

Best Regards,
Jessica


"Nothing in this world can take the place of persistence.
Talent will not; nothing is more common than unsuccessful people with talent.
Genius will not; unrewarded genius is almost a proverb. Education will not;
The world is full of educated derelicts. Persistence and determination alone are omnipotent.
The slogan 'press on' has solved and always will solve the problems of the human race." -- Calvin Coolidge
lemkepf
Forum Members
Forum Members
Posts: 163
Joined: Tue Oct 18, 2005 8:30 pm

Re: Using URL ?page=???? in if then statement

Post by lemkepf »

The way i did it was make a completely different template for the homepage. So my homepage doesn't display the breacrumbs and makes other things look different. Then on every other page i use a different template that includes that stuff.

That's the easiest way i found. :)
jbogard

Re: Using URL ?page=???? in if then statement

Post by jbogard »

Thanks I didn't think about that duh!! I just downloaded this thing and I am having a blast with it, it is so easy to use!!

Thanks Again

Jessica
geraud

Re: Using URL ?page=???? in if then statement

Post by geraud »

Hi,

I have the same problem but I don't want to use a different template for each page (lot of work if you want to change the template of your site).

Is there another solution ?

Cheers
Geraud
amygdela

Re: Using URL ?page=???? in if then statement

Post by amygdela »

you shouldn't use $page, but $_get['page'] there's a very big chance your registerglobals are on.
thetallguy

Re: Using URL ?page=???? in if then statement

Post by thetallguy »

geraud wrote: I have the same problem but I don't want to use a different template for each page (lot of work if you want to change the template of your site).
For my site, I wanted several different types of pages, which meant different templates, but have a lot of the same stuff appearing on each.  My solution was to make HTML Blob modules for each kind of thing on the page. For example, there's a blob for everything in the , another for the page header, and another for the page title block (which in this design is not the same as the header). Content area, footer, sidebar, etc.

With all these blobs, I could then easily drop them into different templates.  The templates roughly 12 lines long, each using slightly different combinations of Blobs.  Change a Blob, and all the page designs change.

Michael
xviper

Re: Using URL ?page=???? in if then statement

Post by xviper »

Here is my solution to a similar problem:
I created an extra tag (a function.pageshow.php in the plugins folder for example) and used the following function:

function smarty_cms_function_pageshow($params, &$smarty) {
global $argv;
$query_string = $_SERVER['argv'][0];

$pg = strstr($query_string, "page=");

return $pg;
}

This should return "page=????" if there are no trailing variables. One can play a bit with the string parsing and get the desired result. The function can be then easy used for templates with {pageshow}.
Last edited by xviper on Wed Apr 19, 2006 7:58 am, edited 1 time in total.
Chuky
Forum Members
Forum Members
Posts: 31
Joined: Wed Mar 29, 2006 3:06 pm

Re: Using URL ?page=???? in if then statement

Post by Chuky »

thetallguy wrote:
geraud wrote: I have the same problem but I don't want to use a different template for each page (lot of work if you want to change the template of your site).
For my site, I wanted several different types of pages, which meant different templates, but have a lot of the same stuff appearing on each.  My solution was to make HTML Blob modules for each kind of thing on the page. For example, there's a blob for everything in the , another for the page header, and another for the page title block (which in this design is not the same as the header). Content area, footer, sidebar, etc.

With all these blobs, I could then easily drop them into different templates.  The templates roughly 12 lines long, each using slightly different combinations of Blobs.  Change a Blob, and all the page designs change.

Michael
The html blob and global content blob looks attractive option but am wondering if it wont in anyway going to affect the loading speed of the site? Am a new person to both cmsmadesimple and programing but i am having a feeling using only blobs may affect the speed of the site. Someone correct me and set me straight pleas.
Post Reply

Return to “Tips and Tricks”