The package zref
is made for such tasks: Extraction of label data, if the relevant \zlabel
etc. commands are used.
In order to provide the correct information, a 'property' has to be stored, in this case the property is the part number which should be connected to the label.
The command \here
stores the label with the given name using \zlabel@byprops
and \there
extracts the information later on.
Update Version with working hyperlinks:
\documentclass{scrbook}
\usepackage[counter,user,hyperref]{zref}
\makeatletter
\AtBeginDocument{%
\@ifpackageloaded{hyperref}{%
}{
\providecommand{\phantomsection}{}
\providecommand{\hyperlink}[2]{#2}
}
\zref@newlist{partpage}
\zref@newprop*{partprop}[-1]{\number\value{part}}
\zref@addprops{partpage}{partprop,page,anchor} % page is defined by default!
\newcounter{herecntr}
\newcommand{\here}[1]{%
\phantomsection% Needed for correct hyper links
\zref@labelbyprops{#1}{partprop,page,anchor}%
}
\newcommand{\there}[1]{%
Part \zref[partprop]{#1}, page \hyperlink{\zref@extract{#1}{anchor}}{\zpageref{#1}}
}
}
\makeatother
\usepackage{hyperref}
\usepackage{blindtext}
\begin{document}
Now, let us see\footnote{You will find in \there{firstref} some important information, but in \there{secondref} the information is much more important. Give it a try, but do not forget the stuff in \there{somethingdifferent}}
\part{My wonderful first part}
\blindtext[6] firstref\here{firstref}
\part{My second and yet better part}
\blindtext[7] secondref\here{secondref}
\part{My third and yet even better part}
\blindtext[3] thirdref\here{thirdref}
\chapter{Foo}\here{somethingdifferent}
\blindtext[2]
\end{document}

Update With compressed references, i.e. the \there
command does not print the part number if the reference is in the same part!
\documentclass{scrbook}
\usepackage[counter,user,hyperref]{zref}
\makeatletter
\AtBeginDocument{%
\@ifpackageloaded{hyperref}{%
}{
\providecommand{\phantomsection}{}
\providecommand{\hyperlink}[2]{#2}
}
\zref@newlist{partpage}
\zref@newprop*{partprop}[-1]{\number\value{part}}
\zref@addprops{partpage}{partprop,page,anchor} % page is defined by default!
%\newcounter{herecntr}
\newcommand{\here}[1]{%
\phantomsection% Needed for correct hyper links
\zref@labelbyprops{#1}{partprop,page,anchor}%
}
\newcommand{\there}[1]{%
\ifnum\value{part}=\zref@extract{#1}{partprop}\relax% Check whether the current part counter value is the same as the extracted part property from the label
page \hyperlink{\zref@extract{#1}{anchor}}{\zpageref{#1}}
\else% No, it is not the same!
Part \zref[partprop]{#1}, page \hyperlink{\zref@extract{#1}{anchor}}{\zpageref{#1}}%
\fi
}
}
\makeatother
\usepackage{hyperref}
\usepackage{blindtext}
\begin{document}
\part{My wonderful first part}
Now, let us see\footnote{You will find in \there{firstref} some important information, but in \there{secondref} the information is much more important. Give it a try, but do not forget the stuff in \there{somethingdifferent}}
\blindtext[6] firstref\here{firstref}
\part{My second and yet better part}
\blindtext[7] secondref\here{secondref}
\part{My third and yet even better part}
\blindtext[3] thirdref\here{thirdref}
\chapter{Foo}\here{somethingdifferent}
\blindtext[2]
\end{document}
zref
andrefcount
...\here
and\where
macros defined? Which document class do you use? Do you load any cross-referencing packages?