Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If you set the front page path to be 'node/1' and you go to 'node/1' or the alias for that node, $is_front returns FALSE when it should return TRUE.
Comment | File | Size | Author |
---|---|---|---|
#28 | settings_page_info_47_1.diff | 847 bytes | pwolanin |
#20 | path.inc_9.patch | 640 bytes | RobRoy |
#13 | front.patch | 1.42 KB | RobRoy |
#6 | front.page.diff_0.txt | 659 bytes | beginner |
#5 | front.page.diff.txt | 660 bytes | beginner |
Comments
Comment #1
RobRoy CreditAttribution: RobRoy commentedSeems to be an issue with drupal_is_front_page(). Moving and attaching a patch for 4.7.2. I tried to avoid any notices so included the extra isset(), not sure if that will do it.
Comment #2
RobRoy CreditAttribution: RobRoy commentedMaybe we don't need that extra isset since it's already true from the first !isset(). Another patch for 4.7.2.
Comment #3
beginner CreditAttribution: beginner commentedIf the bug exists in cvs, you should provide a patch for cvs first.
I am sure our excellent 4.7 branch maintainer will backport the fix.
Comment #4
RobRoy CreditAttribution: RobRoy commentedPatch for HEAD. I'm pretty sure this won't create a PHP Notice.
Comment #5
beginner CreditAttribution: beginner commentedtested: the patch works as intended.
I couldn't apply the patch though: the diff must be malformed. I had to apply it manually.
Here is basically the same patch for head, that should apply cleanly.
Comment #6
beginner CreditAttribution: beginner commentedsame without extra space :)
Comment #7
drummWould simply
$_GET['q'] == variable_get('site_frontpage', 'node')
work?
Comment #8
Dries CreditAttribution: Dries commentedI think it would, and it might actually work better in presence of URL aliasing tricks (might not be applicable for front page). Anyway, worth giving a try.
(Do we need a function for this at all? It seems like a trivial test.)
Comment #9
drummI'd like to see a function used by themes instead of the PHPTemplateism of an extra variable that doesn't exist in the original themeable function.
Comment #10
Dries CreditAttribution: Dries commenteddrumm: do you mean we should get rid of:
Comment #11
drummYep.
Comment #12
Dries CreditAttribution: Dries commentedwould work depending on how you look at things.
If 'site_frontpage' variable equals 'node' then http://example.com/node will also be considered as the front page. I don't think that would be a problem, so I suggest we go with Neil's suggestion.
Comment #13
RobRoy CreditAttribution: RobRoy commentedPer the discussion, check this patch for HEAD that removes drupal_is_front_page() and includes the condition in the phptemplate setting of $is_front. Thoughts?
Comment #14
RobRoy CreditAttribution: RobRoy commentedScratch that last patch. I misunderstood. We want to keep drupal_is_front_page() but remove the $is_front from phptemplate alltogether?
Comment #15
beginner CreditAttribution: beginner commentedUnless I'm mistaken, this won't work if q is not set:
$_GET['q'] == ''
, so the extra condition is necessary.Comment #16
RobRoy CreditAttribution: RobRoy commentedThat's what I thought, but $_GET['q'] == variable_get('site_frontpage', 'node') works just fine when accessing http://www.example.com/ or /node. Just do a var_dump($_GET['q']) in your page.tpl.php to see it.
Comment #17
RobRoy CreditAttribution: RobRoy commentedWhat's the word on this? What can I do to make help this get committed? Changes? New patch?
Comment #18
lennart CreditAttribution: lennart commentedin some cases it is more complicated - imagine you have the top-level of a book set as frontpage. Now this patch would solve the problem of the breadcrumb being there when the top-level page in the book is accessed directly.
But if you then choose any child-page 'content' will be injected in the breadcrumb because child-pages have no way of nowing that the parent-page is actually also the frontpage.
This makes it impossible to use book to create a consistent hierarchical with a book as frontpage.
Comment #19
lennart CreditAttribution: lennart commentedto clarify: home in the breadcrum would lead to frontpage, but so would the name of the top-level book page chosen to be front page - when browsing a childpage.
Comment #20
RobRoy CreditAttribution: RobRoy commentedI know this is a small issue, but I'd like to resolve it. Dries, drumm you both want the themes to start using drupal_is_front_page() instead of $is_front? I feel like $is_front is pretty useful in most themes so and is worth keeping in there.
Here is a re-rolled patch against HEAD that just fixes the drupal_is_front_page() function.
Comment #21
RobRoy CreditAttribution: RobRoy commentedComment #22
drummCommitted to HEAD.
Comment #23
(not verified) CreditAttribution: commentedComment #24
Mad Maks CreditAttribution: Mad Maks commentedThis fix causes bug http://drupal.org/node/77294 : the custom front.tpl.php is not used anymore for the frontpage. my front page is node 284 with "front" as alias. on the setting page the frontpage is set to the alias front.
MM
Comment #25
drummThere only needs to be one bug open for this. The second one is sufficient.
Comment #26
pwolanin CreditAttribution: pwolanin commentedFor this patch to work, it seems that the front page setting has to be restricted to a system path. I don't think this is clear from the form text, nor do I think that this is validated (can it be?).
With this patch, if I put a path alias as the front page, the link to "home" brings me to the right page, but drupal_is_front_page() returns FALSE.
Comment #27
Mad Maks CreditAttribution: Mad Maks commentedindeed, if i put node/286 as frontpage on the setting page, there is no problem. mysite.com/front and mysite.com/node/286 are using the front.tpl.php. but if i put the alias on the setting page mysite.com/front and mysite.com/node/286 aren't using the front.tpl.php.
@drumm: sorry for the two bugs but i think the other one has to be closed and this one active. i filed first a bug but nobody did respond. today i had the time to track what was causing the problem and i found this bug. i didn't close the other one yet because i thought it was good to write there that i fount cause of the problem.
Comment #28
pwolanin CreditAttribution: pwolanin commentedShould this be a new issue? Small patch attached just tried to clarify the settings page.
Comment #29
beginner CreditAttribution: beginner commentedcheck those issues:
doesn't work with aliases urls
http://drupal.org/node/78398
drupal_is_front_page fails if front page is aliased
http://drupal.org/node/77479
Comment #30
RayZ CreditAttribution: RayZ commented@pwolanin: Regarding #26, let's deal with it as a separate issue (http://drupal.org/node/77479) with it's own patches so we can close this one.