Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPhilip Harper
10,033 PointsCan I have an Array containing links / urls?
I've got an array of Categories for my menu nav and wondering can I turn these into links?
$categoriesArray = array (
1 => 'Archaeology',
2 => 'Architecture',
3 => 'Art',
4 => 'Artist & Writers Homes',
5 => 'Decorative Arts & Design',
6 => 'Fashion & Textiles',
7 => 'Gardening & Horticulture',
8 => 'Historic Houses & Buildings',
9 => 'Local History',
10 => 'Medical',
11 => 'Military & Naval',
12 => 'Music',
13 => 'Natural History',
14 => 'Religion',
15 => 'Science, Technolgy & Industry',
16 => 'Sport',
17 => 'Theatre',
18 => 'Transport & Travel'
);
so,
$categoriesArray = array (
[archaeology] => 'http//www.sitename.com/categories/archaeology.php',
[architecture] => 'http//www.sitename.com/categories/architecture.php'
[art] => 'http//www.sitename.com/categories/art.php'
...
and then echo the value [art] for example?
Funny enough, I'm not on my home computer with dev set-up (in a coffee shop and just had the idea, writing on a laptop)
Before I get excited and work on it, just wondering if this do-able.
Thanks for your help!
xxx
1 Answer
Kristian Terziev
28,449 PointsHello Philip,
You should not have any problems doing that. In fact this is how most people setup config.php file for BASE_URL and ROOT_PATH.