We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Global Variables - Wiki?

Development and Programming

wikitect's avatar
wikitect
136 posts
15 years ago
wikitect's avatar wikitect

As the Global Variables aren’t global (they don’t work in all parts of EE e.g. the wiki) is there a way that I can replicate the functionality, preferably getting something out of the exp_global_variables table in a way that the wiki will allow? I have some numbers, e.g. totals that affect 50 or so pages at a time and getting fed up with the admin overhead.

[Mod Edit: Moved to the Development & Programming forum]

       
Ingmar's avatar
Ingmar
29,245 posts
15 years ago
Ingmar's avatar Ingmar

I am afraid there is nothing like that built into EE. You would probably be able to do that with a bit of PHP, though.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

Actually, the wiki is run through the main template engine - this means that global variables should work.

Can you confirm what type of global variables you’re using? Snippets? User defined? Standard? And also - how, exactly, you’re using them?

       
wikitect's avatar
wikitect
136 posts
15 years ago
wikitect's avatar wikitect

As per the channel template i.e. {global variable name} in the wiki page. Is this not the way?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

It is, but it would be helpful to know which variable you’re using, and exactly where in your wiki template.

Thanks!

       
wikitect's avatar
wikitect
136 posts
15 years ago
wikitect's avatar wikitect

I have a global variable {total_naf_subviews} which simply contains a number, 47. Tried embedding it in a wiki page and it is not parsed - get the tag name as a literal text string.

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
15 years ago
John Henry Donovan's avatar John Henry Donovan

wikitect,

Tried embedding it in a wiki page and it is not parsed - get the tag name as a literal text string.

Ah ok. No your global variable will not work here. What Lisa is referencing is the actual Wiki templates where global variables work fine.

Would adding your variable to one of these templates work in this instance for you?

       
wikitect's avatar
wikitect
136 posts
15 years ago
wikitect's avatar wikitect

No - I’m trying to solve the problem of repeated values (like constants or common snippets of text) in articles rather than page design. The trouble is these things will be tiny and be fragments so you wouldn’t want to see them listed with the other wiki pages.

Can I just embed php into a wiki page or is there anything I need to wrap it in?

       
Brandon Jones's avatar
Brandon Jones
5,500 posts
15 years ago
Brandon Jones's avatar Brandon Jones

wikitect,

Yes, if the template on which you have your wiki tag is set to allow PHP, you can use PHP in the Wiki theme files.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

There are two things going on here:

  1. A wiki “entry” - that is when you go to the front-end and create a new article or edit an existing one. This content can not take PHP or EE tags.

  2. The wiki theme - this is the design that goes through the template engine. You can use PHP and EE tags here, with the caveat mentioned by Brandon.

I’m not always sure if you’re referring to 1 or 2, hence some of the confusion. Sorry about that.

       
wikitect's avatar
wikitect
136 posts
15 years ago
wikitect's avatar wikitect

In which case I’m stuffed - it’s the wiki article where I’d like to make it more maintainable by having ‘constants’ wrt snippets of text in a single place, which I’m referring to i.e. 1)

Is it possible to create a plugin or similar for the wiki and have the wiki tag set extended by a plugin? If so, where would I find out about how to construct such a thing? It just seems sensible to be able to manage and reference static content centrally and this seems ripe for some extra functionality. It’s frustrating that it is there in the DB but cannot be accessed!

Ta

       
Greg Salt's avatar
Greg Salt
3,988 posts
15 years ago
Greg Salt's avatar Greg Salt

Hi wikitect,

There are a couple of extension hooks that might be the best way to do this. I’ll move this thread into the Development and Programming forum where you can get some help with the best way to proceed.

Cheers

Greg

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

Wikitect, did you see the wiki article embeds?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.