I've been making the node entries have their own containers and i'd like to carry that theme to the admin areas and create content page. The problem is - when a div in node.tpl.php is defined via div and css the same div tag is not placed on the admin, calendar, or the create content stuff. There is only the background that has been placed for the overall container i've specified. I was thinking perhaps there is a *magic* if / else clause i could throw in my page.tpl.php that says, "if it's an admin page, then contain in this class element, elseif it is a node then use this element". I'm not familiar enough with the php calls that i can figure this out.
Anyone have any good tips, workarounds, solutions?
Comments
arg
That might be the kind of thing you are thinking of doing in page.tpl.php... and it may work - someone please correct me if I'm wrong ;-)
andre
hmmm wish I knew something
That helps a lot, I haven't tried it yet, because I wouldn't know what to put in as $something. Perhaps I would also need to modify template.php ?
helps a lot actually...
I've been too busy to actually think about what you wrote. For my purposes I didn't need to have any print commands, just the arg at the beginning... thanks! Now I can include a specific div when on the admin screen and a bunch of others...
for example:
allows me to provide a background to the admin, create content, and edit content screens, with just one div tag. This is really useful to me because I have entries sort of as their own little boxes, with a background behind them. This background wasn't great to have text against.
for those that are interested the number inside the parenthesis is where it falls in the url, so:
http://yoursite.com/admin is arg(0)
http://yoursite.com/node/1/edit is arg(2)
http://yoursite.com/node/add is arg(1)
EDIT: oops! don't use class="admin" - it's already used. I changed this to class="backend"
arg is great is
Also
arg(0) == user
is another good one to use... It works even if you changed the user profile path with URL alias.
If there's any other places that are difficult to get themed and this works please post them!
arg(0) == product for the
arg(0) == product
for the product page in e-commerce.
Glad that helps
And don't feel you are restricted to the page.tpl.php file. It could come in handy by overriding some other theme functions in your custom tpl files or other standard template files.
andre
Watch out with URL Alias
The above works well, however I had set up 'mysite/careers/vacanices' to point to 'taxonomy/term/13' to display a list of my vacancies. I tried to use
arg(1)=='vacancies'to target the vacancies part of the URL. It did not work.When I printed out the arg(0) I got a result of 'taxonomy', likewise with arg(1) a result of 'term'.
This makes it not as intuitive or as usefull as I first thought.
How could you tagert a specific collection of nodes using mine as an example just targeting all the nodes that were published under the category of vacancies. Can this be done using a modfied node.tpl.php? If so what variables etc can be used?
Thanks
arg() not working with URL alias?
I have read drupal handbooks about using arg(). And I already test them. Then i realize that i can't use arg() with URL generated by URL alias. Does anyone can solve this problem?
$_REQUEST['q']
Interesting alternative using:
$_REQUEST['q'] and explode
http://drupal.org/node/57969
FnL