If this is your first visit, check our documentation. To post, register or login.

array question...

Started by swamyg1 on 21 Jan 2013, 12:53 AM · Views: 891

Results 1 to 6 of 6
21 Jan 2013, 12:53 AM
#1
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Post #1 by swamyg1

I need to create an array to allow for other meta information to load within other sections of my site.

Right now I have this, but it only works for one page:

<?php if ($_GET['main_page'] != 'mypage') { ?>

I need to create an array so I can do this for multiple pages, and close it with a <?php } ?>

Can someone please hook me up with the code for the array?

21 Jan 2013, 7:51 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

<?php 
  if (!in_array($_GET['main_page'], array('mypage', 'yourpage', 'yomammaspage'))) {
    // do something here
  }
?>

Ref: http://www.php.net/in_array

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

21 Jan 2013, 9:04 PM
#3
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Post #3 by swamyg1

Why you gotta talk about my momma?

j/k... Thanks for the hook up it works perfectly!

17 Feb 2013, 7:11 PM
#4
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Post #4 by swamyg1

Hi Dr. Byte,

I tried looking, but I could not figure how to stop a function using the array?

I would like to prohibit the Zen Cart canonical stuff from displaying if those above pages are loaded:

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
<?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
<link rel="canonical" href="<?php echo $canonicalLink; ?>" />

Could you please help?

17 Feb 2013, 7:23 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #5 by drbyte

swamyg1:

I would like to prohibit the Zen Cart canonical stuff from displaying if those above pages are loaded
Just wrap that "if" statement around whatever you want it to affect.

But ... Um ... not sure I understand "why" you want to muck with the canonical stuff ... ?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Feb 2013, 7:40 PM
#6
swamyg1 avatar

swamyg1

Zen Follower

Join Date:
Dec 2008
Location:
San Fran
Posts:
382
Plugin Contributions:
0

Post #6 by swamyg1

It's because I have a wordpress blog that pulling in it's own meta info...

But for the canonical it would always pull up the following for every page:

<link rel="canonical" href="http://www.mywebsite.com/index.php?main_page=blog" />

Wrapping the array around it worked for me, thank you!